469,578 Members | 1,869 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

Browser window close check in Action Script

14
Hi All,

I wanted to know, can I check in action script whether the browser window which loads my swf file has been closed? Basically I wanted to call a action script function which will be triggered when the browser window is closed. Can I do this check in action script of the flash file which is loaded in the browser?


Thanks in advance,
Apurva G
Jul 28 '08 #1
1 5733
bnashenas1984
258 100+
Hi
This is not the exact answer to your question but it might help.

As you might know many people are having problems because of difference between internet browsers like IE and FireFox. I don't think what you need is possible . I'v been looking for the same thing for months and found nothing.

But what you can do is to check with JAVA script on the same page that you have your SWF file .

Here is the HTML code to do this.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>Detecting browser close in IE</title>
  4. <script type="text/javascript">
  5. var myclose = false;
  6. function ConfirmClose()
  7. {
  8. if (event.clientY < 0)
  9. {
  10. event.returnValue = 'Any message you want';
  11. setTimeout('myclose=false',100);
  12. myclose=true;
  13. }
  14. }
  15. </script>
  16. </head>
  17. <body onbeforeunload="ConfirmClose()">
  18. Close browser!
  19. </body>
  20. </html>
  21.  
But as I said because of differences between browsers this code only works on IE. You might be able to make another code which works on other browsers to


Good luck
Sep 4 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

13 posts views Thread by Kai Grossjohann | last post: by
9 posts views Thread by Graham | last post: by
8 posts views Thread by Ryan Stewart | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.