Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing webpage from flash

Status
Not open for further replies.

clemrock

Programmer
May 20, 2004
118
0
0
US
Hello,

I need to get a script that closes the webpage that a flash file resides from the flash program.

I always see this code:

Code:
on( release ){  getURL("javascript:window.close()"); }

When I try this it never works.

Any ideas?
 
if you are looking to close the whole browser then something like

getURL("javascript: window.opener=self; window.close();");

will work better
 
Man - I've tried that and it doesn't seem to work.

I had no idea that this was going to be such a fiasco.
 
Bill's method should work on IE but not on others such as Firefox. The hack is:
[tt]
getURL("javascript: window.open('','_parent',''); window.close();");
[/tt]
So you have to first determine the browser; if it's IE use Bill's and if not use this.

And I am not promoting closing the browser in any way, oldnewbie! (I hate auto resizing.)

Kenneth Kawamoto
 
Awesome - this isn't impossible like I was starting to think!

Do you have any suggestions as to how to browser detect w/in in Flash or Javascript where I could make it work on as many browsers as possible?

Thanks for your help!
 
System.capabilities.playerType returns "PlugIn" if the SWF is played back in the Netscape plug-ins (Firefox etc) and "ActiveX" if it's played in the IE ActiveX control. So in theory you can use that. But usually people go for Javascript option. Just Google "javascript browser detection" and you'll get hundreds of scripts to choose from.

Kenneth Kawamoto
 
The only thing w/ the Javascript browser detection is that you would have to throw in the browser detection information to the swf when it's loaded in order to know which getURL close method to use.

The only way I can think to do this is use a server script like php and the sendAndRecieve method.

Thanks for y'all's help!

Clem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top