Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
62
rated 0 times [  68] [ 6]  / answers: 1 / hits: 26686  / 12 Years ago, wed, april 11, 2012, 12:00:00

I am using the window location method to redirect a webpage to another after a set amount of time.



The url needs to change from www.myurl.com/home to www.myurl.com/other. The problem is that I do not know what the final URLs will be so I cannot use absolute links, they have to be a path only. This is what I have so far:



 window.location.pathname = mobility.html

More From » jquery

 Answers
3

You can just prepend a / to your URL to make them relative to the domain root (without having to hardcode the domain name). Like this:



window.location = /mobility.html

[#86308] Tuesday, April 10, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jarvisjovannia

Total Points: 127
Total Questions: 123
Total Answers: 101

Location: Netherlands
Member since Mon, Jun 7, 2021
3 Years ago
;