Copy link to clipboard
Copied
Hi!
Quick question... I need to get the browser`s url from a html-embeded swf file.
If the browser`s url is "http://www.mysite.com/stuff/myHtml.html?ln=en", I need to have access to it through my swf file in order to find the value of the ln (language) parameter. Any suggestions?...
Thank you ![]()
a swf can only get its own url which won't help when the query string is appended to the embedding xml file.
you can use:
function urlF(){
return location.href;
}
Copy link to clipboard
Copied
use javascript to obtain the url and use the externalinterface class to pass the url to flash.
Copy link to clipboard
Copied
So there is no direct way to get the url into flash?...
The thing is that I`m making some multi-languaged banners for another programmer. The url`s used in his site have a ln parameter from which I could get the language.
So then... I could call a JavaScript function with ExternalInterface from flash and get the url then move on with my bussiness form there, right? I dont`t know Java script though... You think you could give me the code?... Thanks in advance!
Copy link to clipboard
Copied
a swf can only get its own url which won't help when the query string is appended to the embedding xml file.
you can use:
function urlF(){
return location.href;
}
Copy link to clipboard
Copied
Thank you very much ![]()
I was googling around for the last hour or so and was currently trying with some php code...
You just saved me a lot of time. It worked.
Copy link to clipboard
Copied
There is another way to do that without using JavaScript directly:
var browserURL:String = ExternalInterface.call("window.location.href.toString");
Copy link to clipboard
Copied
Oh, that`s great! Instead of referencing a JavaScript function you just define it right there...
Just tried it out and it works ![]()
Thanks a lot!
Copy link to clipboard
Copied
You are welcome.
Don't forget to check if ExternalInterface exists just to be paranoid.
Copy link to clipboard
Copied
If you're only interested in the query string portion of the url, use: window.location.search
ExternalInterface.call("window.location.search.toString");
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more