Question

That damn SOP strikes again.

So, suppose I have "http://t.co/atyHdwLA" (client-side, we're talking), and I want to obtain "http://foo.com". I had a clever idea to construct an invisible iframe, and then wait a second before querying its contentWindow's location again, after the redirect had taken place. But the SOP prevented me from accessing it. Can anyone think of any other hacks to achieve this, or is it simply not possible in a browser?

Was it helpful?

Solution

Use a service like LongURL. Or ExpandURL, which has an easy to use API.

Use ExpandURL's API along with an XHR request.

Also, have a look at this article on CORS. You may have to use your own server to use this API if their server doesn't support cross-origin requests.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top