View Full Version : Get the end value of a redirected URL

12-17-2007, 11:37 PM
How can I process this redirect URL to get "redirected value" end value using JavaScript?

Lets say this URL:

Redirected you to:

How can I get the end value of the redirect, "http://yahoo.com", using JavaScript?

Something like this?:

var initValue = "http://ad.doubleclick.net/ad/website.com/;sect=;subs=;sz=115x77;ord=4771639";

var newValue = ?? process(initValue); ?? // opens initValue URL and returns the redirect

document.write(newValue); //outputs "http://yahoo.com"

Philip M
12-18-2007, 09:13 AM
This can't be done with JavaScript (security reasons).
It can only be done using a server-side language.

Of course, locally you can use window.location to redirect depending on initValue.