Reputation: 3260
I'm having problem in redirecting at JS.
Here's the situation:
the current directory of the html code is : http://localhost:7927/MyWeb/Catch%20the%20bird%20game/GAME1.html
I want to change the directory to
'http://localhost:7927/MyWeb/games.htm'
I tried using window.location("games.htm"); but it will redirect to that directory:
http://localhost:7927/MyWeb/Catch%20the%20bird%20game/GAME1.html/games.htm
What's the solution? Thanks.
Upvotes: 0
Views: 107
Reputation: 32900
I normally use
window.location.href = ...
or
window.location.replace(...);
Also check out this SO post.
Upvotes: 0
Reputation: 2534
use
window.location = 'http://localhost:7927/MyWeb/games.htm';
or just this
window.location = '/MyWeb/games.htm';
Upvotes: 0
Reputation: 1314
You can try:
window.location("../games.htm");
or:
window.location("/MyWeb/games.htm");
Upvotes: 1