Home > Uncategorized > IFrames and the back button

IFrames and the back button

If you have an Iframe on a page, and you press the back button, then oftentimes, only the Iframe goes back in it’s history, not the containing page.
There are a few workarounds for this, this is just a proposal, if it helps…
firstly, if you have a pre-loader on the iframe, such as…
graph.contentWindow.document.write(‘Please wait…’);
graph.src = ‘someurl’
when you can poll the Iframe for a change in the "Please wait message". (Note, that the url that you are redirecting to must be on the same domain as the parent page, or else you get a security exception)
// 951 – back button fix. 
 var wasGraphLoaded = false;
 function checkGraph()
  if (imgGraph.document.body.innerHTML.indexOf("…")==-1)
   // Graph must be loaded…
   wasGraphLoaded = true;  
   // Graph isn’t loaded.
   if (wasGraphLoaded)
    // The back button bust have been pressed
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: