Issue
I am trying to get a hold of a URL that another URL redirects to.
For instance, I go to http://www.example.com/redirect. Now this page redirects me to http://www.some-other-domain.com/?language=english.
How do I get the http://www.some-other-domain.com/?language=english URL using Javascript, only knowing the http://www.example.com/redirect URL?
Solution
If your browser is set up to allow opening a new window or tab, you can do something like this:
var whndl, otherURL; //whndl=window-handle
function prep()
{ window.name="thiswindow";
whndl = window.open("http://www.example.com/redirect", "otherwindow");
setTimeout("fetchURL();", 500); //half-second for page to at least partly load
return;
}
function fetchURL()
{ otherURL = whndl.document.URL; //should be the redirected URL
whndl.close(); //if you don't need it open any longer
return;
}
You might be able to hide the "otherwindow" as this is done, so nobody sees it, perhaps by using the "pop-under" trick (I confess at this time I don't know exactly what that trick is).
Answered By - vernonner3voltazim
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.