Question : Refresh only current iframe on F5

Hello experts,

I  have the following structure

main frame
  - iframe
    -- subiframe1
    -- subiframe2
    -- subiframe3
    -- subiframe4

The goal is that if someone click on F5 within iframe that that iframe is being reloaded.
Generally browser reload main frame.
I tried some work around with jquery.

  $(window).ready(function () {
    $(window).keypress(function(event) {
            if(event.keyCode==116) {
            location.href=location.href;
        return false;        
        }
    });
});
 
It worked in iframe.  But when the focus is on subiframes browser is reloading main frame again.

Is there a solution on the level of iframe or I have to change every subframe?

Answer : Refresh only current iframe on F5

so you need to add the code to all the iframes or run over all the iframes and add it to them (not simple)

The better method is to store each frame in a cookie and allow refresh of the main window, putting the frame content to all subframes when reloading. As an internet user, I ALWAYS rightclick on the frame and do refresh frame if I want to only refresh a frame. I never expect the f5 to work with single frames
Random Solutions  
 
programming4us programming4us