auto close pop up window
June 23, 2006 10:36 AM
How do I alter this piece of code to make the pop up window close automatically after exactly 37 seconds?
Here's the piece of code with { } substitued for <>:
{script language="javascript"}
timer=setTimeout("window.open('video_popup.html',','width=550,height=400')",5000)
{/script}>
Here's the piece of code with { } substitued for <>:
{script language="javascript"}
timer=setTimeout("window.open('video_popup.html',','width=550,height=400')",5000)
{/script}>
Capn, your code makes the pop up window wait 37 seconds before it opens. I want it to open immediately and close after 37 secs.
posted by wsg at 11:12 AM on June 23, 2006
posted by wsg at 11:12 AM on June 23, 2006
If the page you're popping up is one that you control (and can add code to), you should be able to do something similar to what you have there. Instead of using window.open() on a time, there's a window.close() method that closes a window (I'm not sure if it's still useful, but it used to be that you could only close JS-opened windows with JS, and you couldn't close user-opened windows like the main browser window (at least, not without a prompt of some kind)).
posted by Godbert at 11:18 AM on June 23, 2006
posted by Godbert at 11:18 AM on June 23, 2006
So, you would have something like this in a script block in the video_popup.html page:
I'm not sure if there's a way to do it from the page that opened it, if that's what you're asking.
posted by Godbert at 11:23 AM on June 23, 2006
timer=setTimeout("window.close()",37000)
I'm not sure if there's a way to do it from the page that opened it, if that's what you're asking.
posted by Godbert at 11:23 AM on June 23, 2006
Wow. Im curious about the "37 seconds" value. Where did that come from?
posted by Brainy at 1:09 PM on June 23, 2006
posted by Brainy at 1:09 PM on June 23, 2006
Brainy,
The pop up contains a short (37 seconds) flash video of a live band. Whomever designed the pop up page originally set the video to loop, which is really annoying. I don't have the fla. file, just the swf, so I can't edit the flash file to not loop. Now, the window closes as soon as the clip has played once, before it has a chance to loop again. I would post a link, but I'm afraid the bandwidth strain on the server would be prohibitive.
posted by wsg at 2:04 PM on June 23, 2006
The pop up contains a short (37 seconds) flash video of a live band. Whomever designed the pop up page originally set the video to loop, which is really annoying. I don't have the fla. file, just the swf, so I can't edit the flash file to not loop. Now, the window closes as soon as the clip has played once, before it has a chance to loop again. I would post a link, but I'm afraid the bandwidth strain on the server would be prohibitive.
posted by wsg at 2:04 PM on June 23, 2006
The video is exactly 37 long and you're over-optimistically betting there are no network issues that will
buffering... buffering... buffering...
cause the video to actually take longer to run?
posted by orthogonality at 2:05 PM on June 23, 2006
buffering... buffering... buffering...
cause the video to actually take longer to run?
posted by orthogonality at 2:05 PM on June 23, 2006
You have a point orthogonality. I will have to test it on some other machines. What do you recommend? Obviously, I am a novice programmer.
posted by wsg at 2:07 PM on June 23, 2006
posted by wsg at 2:07 PM on June 23, 2006
Been a long time since I fiddled with javascript like that, but would calling the timer from onLoad() work to beat the "buffering..." issue? e.g.
posted by Pinback at 2:59 PM on June 23, 2006
<script> function CloseWindow() { timer=setTimeout("window.close()",37000); return true; } </script> <body onLoad(CloseWindow())>(On second thoughts: probably not, because the video is an embedded object...)
posted by Pinback at 2:59 PM on June 23, 2006
I bet if you'd asked "how can I deconstruct and edit a SWF file for which I don't have the original FLA?" you'd have got your looping problem sorted already.
posted by AmbroseChapel at 5:35 PM on June 23, 2006
posted by AmbroseChapel at 5:35 PM on June 23, 2006
Have you tried putting {PARAM NAME="LOOP" VALUE="false"} within the OBJECT statement and LOOP="false" into the EMBED tag? This won't help if the flash file was built with a specific gotoAndPlay(1) command but should help override the default looping.
posted by blag at 6:36 PM on June 23, 2006
posted by blag at 6:36 PM on June 23, 2006
AmbroseChapel, in my ignorance, I didn't realize that was an option. How can I deconstruct and edit an SWF file for which I don't have the original fla.?
posted by wsg at 11:45 PM on June 23, 2006
posted by wsg at 11:45 PM on June 23, 2006
You'll just have to wait a week and ask again!
No seriously. I haven't done it myself but I've sat next to someone who did it all the time, using, I think, SWFDecompiler.
posted by AmbroseChapel at 2:56 AM on June 24, 2006
No seriously. I haven't done it myself but I've sat next to someone who did it all the time, using, I think, SWFDecompiler.
posted by AmbroseChapel at 2:56 AM on June 24, 2006
blag, that worked. Thanks. Y'all are good! (But, I knew that already.)
posted by wsg at 9:44 AM on June 24, 2006
posted by wsg at 9:44 AM on June 24, 2006
This thread is closed to new comments.
posted by Capn at 10:38 AM on June 23, 2006