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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check page location then action depending on it 1

Status
Not open for further replies.

derwent

Programmer
May 5, 2004
428
GB
I have a .html page that need to be a little smarter.

Is it possible in javascript to do the following

Check the url of the page
IF the page is say page1.com THEN redirect to page1.com/new
ELSE it will be page1.com/new so process page.


I would usually do this using php but the page has to stay .html.

Thanks
 
Code:
<script type="text/javascript">

if (window.location == "[URL unfurl="true"]http://www.page1.com/somepage.html")[/URL] {
   window.location = "[URL unfurl="true"]http://www.page1.com/new/somepage.html";[/URL]
}

</script>

-kaht

Looking for a puppy?

silky-icon-left.gif
[small]Silky Terriers are small, relatively odorless dogs that shed no fur and make great indoor pets.[/small]
silky-icon-right.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top