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 1 of 1
  1. #1
    New Coder
    Join Date
    Jul 2010
    Posts
    16
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Appending user email address to window location

    EDIT: I SOLVED THIS BY USING "#" instead of "?". Thank you.

    Hello.

    My goal is to take a user's email from a form, store it in a cookie, and append it to the window location on the following page. I am doing this so that when a user shares the page with "add this widget" the stats will show me who shared the page.

    The problem I have is that window.location.replace("?"+ user_email); seems to be sending the browser in an infinite loop. Right now it is running as an inline function in the head. I tried calling the function with body onload and had the same problem.

    Code:
    <script = "Javascript">
    (function readCookie() {
    
    var user_email = unescape(document.cookie);
    
    if (document.cookie)
      {
     window.location.replace("?"+user_email);
      }
    
    })();
    </script>
    Is there another way I could achieve the same result?

    Thank you,
    Jack
    Last edited by thejackkelly; 07-30-2010 at 08:19 AM. Reason: solved problem


 

Posting Permissions

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