2 Replies - 670 Views - Last Post: 16 July 2012 - 11:57 AM

#1 Gary_Leeds  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 08-July 12

Pausing a script without killing the browser window opened

Posted 10 July 2012 - 06:37 AM

Apologies if this is breaking forum rules starting a new thread about a problem I have already listed but the issue is now different to the problem I originally had so hopefully this is acceptable.

Simply I want to open a window, let it load and close it 5 seconds later but javascript does not have any pause command that I can find, settimer will queue up the close but then carry on executing the rest of the script before it has closed and any delay I have tried using the various pause examples I can understand have resulted in browser lock ups without the page loading before the window is closed. I even tried a very large for loop with nothing being done in it and that still caused a browser freeze.

Is there anyway of inducing a delay that will not freeze the loading of a browser window up?

thanks in advance
Gary

Is This A Good Question/Topic? 0
  • +

Replies To: Pausing a script without killing the browser window opened

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3490
  • View blog
  • Posts: 10,058
  • Joined: 08-June 10

Re: Pausing a script without killing the browser window opened

Posted 10 July 2012 - 06:40 AM

Im not aware of any real sleep functionality in JS.

on the other hand side, why should JS have one? it is an event-based scripting language, i.e. code is executed, if an event occurs. inbetween, JS is idle.
Was This Post Helpful? 0
  • +
  • -

#3 JMRKER  Icon User is offline

  • D.I.C Addict

Reputation: 128
  • View blog
  • Posts: 826
  • Joined: 25-October 08

Re: Pausing a script without killing the browser window opened

Posted 16 July 2012 - 11:57 AM

Why does it have to open a window and pause.

Why not display a <div> area as big as you want for a
setTimeout() amount of time (5 seconds) and then hide it
to show the rest of the now preloaded page?
:rolleyes2:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1