Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Get the end value of a redirected URL

    How can I process this redirect URL to get "redirected value" end value using JavaScript?


    Lets say this URL:
    http://ad.doubleclick.net/ad/website...77;ord=4771639

    Redirected you to:
    http://yahoo.com

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

    Something like this?:
    Code:
    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"

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,149
    Thanks
    203
    Thanked 2,547 Times in 2,525 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •