how to get relative url depending on another file code example
Example 1: js redirect to relative url
window.location.href = '/path'; //relative to domain
Example 2: javascript redirect
window.location.href = "http://mywebsite.com/home.html";
window.location.href = '/path'; //relative to domain
window.location.href = "http://mywebsite.com/home.html";