Page 1 of 1

get document.location and redirect

Posted: Tue Oct 28, 2003 8:32 am
by Nay
I want to have a favorite that I can click on, that will take the page's location and register as a variable and redirect.

Like the favorite's location is:

Code: Select all

javascript:var=document.location;document.location="http://locahost/parse.php?url="+var
Apparently that didn't do anything at all. I'm using Mozilla 1.5.

-Nay

Posted: Tue Oct 28, 2003 8:44 am
by scorphus
var is a JavaScript keyword used to declare variables. Try this:

Code: Select all

var loc = document.location;
document.location = "http://locahost/parse.php?url=" + loc;
Regards,
Scorphus.

Posted: Tue Oct 28, 2003 8:48 am
by scorphus
Or you could use only one line:

Code: Select all

document.location = "http://localhost/parse.php?url=" + document.location;

Posted: Tue Oct 28, 2003 9:35 am
by Nay
Thanks a lot dude! My final is:

Code: Select all

javascript:document.location = "http://localhost/scripts/xanga/override.php?url=" + document.location;
Thanks again, the override.php with do a $_GET['url'] and do some other stuff lol.

-Nay