Window.location with relative url

I am trying to use window.location to redirect to relative URL

this variable

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

it matters

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

it will not be redirected

 window.location = redirect; 
+4
source share
2 answers

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

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

You can use:

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

Source: https://habr.com/ru/post/1403933/


All Articles