Para ir para uma URL relativa ao nome de domínio atual em Javascript, use window.location.origin assim:
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