Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drop Parameters when writing URL to page

Status
Not open for further replies.

dontpunchme

Programmer
Jul 29, 2002
20
US
I would like to write the URL of the page that the user is on, but I don't want to include the extra parameters that are in the URL.

<script>
document.write(document.URL)
</script>

Example URLs:


I would like the URL I write out in the page to just write out and drop the extra stuff.

Thanks.
 
Try this:
Code:
<script>
document.write(String(document.URL).split("?")[0].split(";")[0]);
</script>

-kaht

...looks like you don't have a job, so why don't you get out there and feed Tina.
[banghead]
 
Word.

-kaht

...looks like you don't have a job, so why don't you get out there and feed Tina.
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top