Lunarpages Web Hosting Forum

Author Topic: setinterval halted on new page loading in iframe  (Read 2204 times)

Offline alanyap

  • Spacescooter Operator
  • *****
  • Posts: 34
setinterval halted on new page loading in iframe
« on: January 13, 2006, 01:10:57 AM »
I have a main.htm page that holds an iframe and some javascript on countdown timer (in minutes  and seconds)

the iframe initially will load page1.htm that invoke the timer and proceed to load page2.htm

to avoid user pressing BACK button after page2.htm is shown (that will reset the timer), I proceed to code a document.location="page3.htm" at onload in page2.htm

(the page2.htm is actually an intermediate dummy page)

page3.htm is the one that contains some real html that might take a few seconds to load.

in short..

main.htm
has iframe containing
   - page1.htm               --->--> page2.htm         ---->- page3.htm
           > invoke timer               > load page3.htm             > contains final html shown
          > load page2.htm


it works OK on my production laptop, with speedy loading/compilation of the pages (actually they're jsp)

BUT in LP server.. the loading of page3 lags a bit, and this causes the timer to halt permanently.

is this a general javascript flaw? or are there any workaround ?





 



« Last Edit: January 13, 2006, 01:12:53 AM by alanyap »

Offline miniturismo

  • Pong! (the videogame) Master
  • *****
  • Posts: 21
    • miniturismo.co.uk - Fine MINI Adventures Since 2004
Re: setinterval halted on new page loading in iframe
« Reply #1 on: February 10, 2006, 03:13:51 AM »
A more robust solution could be to remove all of the JavaScript and add the following element in the <head> of your first page:

Code: [Select]
<meta http-equiv="refresh" content="30;url=http://yoursite.com/page3.htm">
This will forward the page after 30 seconds. You can then also ditch the intermediate page2.htm