Blainer
Blainer

Reputation: 2702

window.location with relative url

I am trying to use window.location to redirect to a relative url

this variable

var redirect = $(this).attr('title');

has this value

../../000_Movies/_assets/playlist.html

this wont redirect

window.location = redirect;

Upvotes: 4

Views: 15535

Answers (2)

ThdK
ThdK

Reputation: 10556

You can use:

window.location.href = $(this).attr('title');

Upvotes: 0

Bogdan Emil Mariesan
Bogdan Emil Mariesan

Reputation: 5647

If you want to redirect to relative pages you should use:

 window.location.href = "../../000_Movies/_assets/playlist.html";

Upvotes: 7

Related Questions