Чтобы перейти на URL, относительный к текущему доменному имени в Javascript, используйте window.location.origin вот так:
goto_relative_url.js
window.location.href = window.location.origin + "/myurl"
Check out similar posts by category:
JavaScript
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow