Answer the question
In order to leave comments, you need to log in
How to bookmark the browser in JS to go to the url of the current domain in the window + /custom url?
To begin with, I just tried to pull out the domain code
javascript: window. open (location. hostname);
as a result, instead of https://qna.habr.com/ opens https://qna.habr.com/qna.habr.com
Answer the question
In order to leave comments, you need to log in
window.open("http://" + location.hostname)
console.log(location.hostname)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question