View Full Version : Appending user email address to window location

07-30-2010, 09:14 AM
EDIT: I SOLVED THIS BY USING "#" instead of "?". Thank you.


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.

<script = "Javascript">
(function readCookie() {

var user_email = unescape(document.cookie);

if (document.cookie)


Is there another way I could achieve the same result?

Thank you,