Reputation:
I have a form on my website. When this form is filled out, it is then validated by a javascript validation function.
At the bottom of this function I have this piece of code:
window.location="../index.html";
This wont work on Chrome, but does work in Firefox.
My Q is, how can I make this simple redirect work on all (most) browsers?
Thanks
EDIT:
This is in a separate js file which is included...
Upvotes: 0
Views: 668
Reputation: 4797
The ../ is not really a valid URL.
If you want to go to your html root (where your index.html is most likely located), simply use "/index.html"
Upvotes: 0
Reputation: 303
window.location works for me in Google Chrome as well as in Firefox.
Upvotes: 0
Reputation: 324507
window.location.href = "../index.html";
... is the preferred way, although setting window.location
does work in Chrome.
Upvotes: 1