idish
idish

Reputation: 3260

Redirect to other window JS

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

Answers (4)

Iridio
Iridio

Reputation: 9271

You should use

window.location.href = "/myweb/games.htm"

Upvotes: 0

Juri
Juri

Reputation: 32900

I normally use

window.location.href = ...

or

window.location.replace(...);

Also check out this SO post.

Upvotes: 0

Uttara
Uttara

Reputation: 2534

use

window.location = 'http://localhost:7927/MyWeb/games.htm';

or just this

window.location = '/MyWeb/games.htm';

Upvotes: 0

primavera133
primavera133

Reputation: 1314

You can try:

window.location("../games.htm");

or:

window.location("/MyWeb/games.htm");

Upvotes: 1

Related Questions