2

Having got an on-pageload fancybox iframe working (see here), I discover that the set-up produces very different responses to browser back-buttons (a problem that goes way back to the good ol' frameset days). If you start here, on Page 1:

...and go to Page 2, you'll see the starting iframe (which is generated onload from code in Page 2). If you open the link in that iframe, a new document opens in the iframe. Click/touch your back-button, to reload the starting iframe. In testing, browser behaviour is as follows...

PC Windows 7

  • Firefox 33 - semi-successful - starting iframe reappears. However, a further click on the back-button produces the starting iframe with no content (iframe blank)
  • Chrome 38 - fails - starting iframe reappears but is blank, content reappears on reload
  • IE 11 - successful - starting iframe re-appears, further click on back-button goes to Page 1 (best result!)

iPad

  • Safari - fails - starting iframe reappears but is blank, content reappears on reload
  • Opera mini - fails - same as Safari
  • Chrome - double-fails - goes straight back to back to Page 1

With so many different responses, I doubt there is a solution for all browsers. But maybe someone out there can help.

Community
  • 1
  • 1
plugincontainer
  • 630
  • 2
  • 9
  • 28
  • Check this http://stackoverflow.com/a/20618474/1055987 if that helps – JFK Nov 05 '14 at 18:01
  • Another interesting article http://www.webdeveasy.com/back-button-behavior-on-a-page-with-an-iframe/ – JFK Nov 05 '14 at 18:05
  • @JFK Tried webdeveasy.com solution, inserting the script at the end of `var myContent =` in the page that generates the iframe. But no luck (http://www.casedasole.it/fancybox/js/back-button2.html). From your SO answer, looks like I need a combination of two fancybox scripts to get it working - i.e. iframe pop-up onload + your `history.length` hack (see http://www.casedasole.it/fancybox/js/2scripts.html). Is that feasible? Maybe you could post that as answer to the question? – plugincontainer Nov 07 '14 at 00:02
  • let me think about it. The issue is that first iframe is created in the DOM so not too sure how it does affect the browser history (if it does) – JFK Nov 07 '14 at 00:32
  • @JFK The backbutton bugs I found (http://www.casedasole.it/fancybox/js/back-button.html) seem to apply only when the iframe is created by the starting page. Maybe it's pushing fancybox too far. – plugincontainer Nov 07 '14 at 01:24

0 Answers0