actionscript 3 - How to get the final URL from a redirect in AS3? -
i need final url link gets redirected. (e.g. if using url shortener)
bit.ly/foobar ->redirect-> http://example.com
what fastest way in as3? you
since using air, can listen httpstatusevent.http_response_status
event:
var urlloader:urlloader = new urlloader(new urlrequest("http://bit.ly/1bddlxc")); urlloader.addeventlistener(httpstatusevent.http_response_status, urlloader_httpresponsestatus); function urlloader_httpresponsestatus(e:httpstatusevent):void { trace(e.redirected, e.responseurl); }
the result of above trace true http://www.google.com/
this event gives information whether url redirected , new url is.
Comments
Post a Comment