Hi
is it possible to read the current URL in the address bar when a page loads using JavaScript?
Thanks
http://www.alljammin.com -Free funky dating and flirting
Capturin URL in JavaScript
Moderator: General Moderators
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
Solution
Code: Select all
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function GetURL(srcID)
{
alert(document.location.href);
}
</SCRIPT>
</HEAD>
<BODY>
<INPUT type="button" value="Button" id=button1 onclick="GetURL(this)">
</BODY>
</HTML>You posed this same question a couple of days ago.
viewtopic.php?t=16799
Why use JavaScript? Why not use this:
$requested_url = $_SERVER['REQUEST_URI'];
Are you trying to get the parent of a frame?
-Jackson
viewtopic.php?t=16799
Why use JavaScript? Why not use this:
$requested_url = $_SERVER['REQUEST_URI'];
Are you trying to get the parent of a frame?
-Jackson
Well im trying to implement faceparty functionality so if someone types say http://www.alljammin.com/shizzle it should diaplay shizzle's profile.
However the only way I can implement is to put a script in my custom 404 error pages which traps the page nout found error, and captures the URL, and reads the username from it, then does a redirect
However the only way I can implement is to put a script in my custom 404 error pages which traps the page nout found error, and captures the URL, and reads the username from it, then does a redirect