PDA

View Full Version : Getting information about the URL hosting an SWF



freakshow
March 25th, 2005, 07:01 PM
Howdy,

Does anyone know of a way to obtain information about the environment that a SWF is served into? Things like the URL of the page that is hosting the SWF?

So say there's the URL http://www.somesite.com/flashpage.html which has the movie flashmovie.swf embeded in it ... is there a way to get the URL from inside flashmovie.swf and cast it into a string datatype?

I've been picking apart the _global object by recursively un-hiding it and the objects it holds properties, but so far have not come up with anything that could prove useful.

I want to be able to do this for error logging.

Any help is much appreciated ...

Chris

SmoothDime
March 25th, 2005, 07:10 PM
i need help with the same thing.

the only thing i know so far is that _root._url is the url to the flash movie. ie something like: http://www.site.com/main/swfs/main.swf. It's not the url to the html file or script, which would be something like: http://www.site.com.

anyone know how to get the html or script url?

thanks

freakshow
March 25th, 2005, 07:40 PM
i need help with the same thing.

the only thing i know so far is that _root._url is the url to the flash movie. ie something like: http://www.site.com/main/swfs/main.swf. It's not the url to the html file or script, which would be something like: http://www.site.com.

anyone know how to get the html or script url?

thanks

i just tried using a PHP script that spat back it's referer, and used loadVariables to get the information, but it seems that when a loadVariables request is made to the php script, the php script doesn't know what it's referer is.

*shrugs*

SmoothDime
March 25th, 2005, 09:32 PM
how do you get the pages url in PHP?

freakshow
March 26th, 2005, 03:09 PM
how do you get the pages url in PHP?

PHP has a plethora of enviroment variables that you can access.

The $_SERVER array contains an element called $_SERVER['HTTP_REFERER'] which containes the URL of the page that the request came from.

However it's blank when you call a PHP page from a flash movie. I'm guessing that's because a loadVariables() request doesn't send the same HTTP headers as a regular HTTP request.