js redirect to relative url
snippet in javascript

javascript redirect

user6770

window.location.href = "http://mywebsite.com/home.html";

js redirect to relative url

user2529

window.location.href = '/path'; //relative to domain

js window location relative path

user1147

//To get just the relative path of a window location.

const RELATIVE_PATH = window.location.pathname;