0

I have a project that i can't use the ExternalInterface to get current url from the browser...

So, someone know how i can get current URL from the browser without using ExternalInterface/JavaScript with the Flash/AS3?

Note: I can only use Javascript, HTML, CSS, AS3.

2 Answers 2

1

I asked this before on the Mochi forums: https://www.mochimedia.com/community/forum/topic/reliably-find-the-page-url

Long story short, there's no 100% reliable way unless you have some sort of control over where the SWF is placed - loaderInfo.url gives you the swf url, not the page one, and some of the time this can be the address of the preloader SWF (e.g if you make a game that goes onto game sites). You could try JavaScript, but that only works if it's enabled and sometimes you'll get the address of an iFrame, rather than the main page URL. Ditto for calling a PHP file.

Your best best is JS, but keep in mind that it's not perfect

var url:String = ExternalInterface.call("window.location.href.toString");

Note, you can do the same when you're embedding the SWF and pass the value in as a Flashvar

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah! Thanks! I don't knew about the loaderInfo.url!
0

Maybe use flashvars to pass the url to your root on creation (look into swfobject.js)

Or look into: stage.loaderInfo.url

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.