D
D
Dim2020-12-04 22:47:25
JavaScript
Dim, 2020-12-04 22:47:25

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

1 answer(s)
N
nikitamarcius, 2020-12-04
@Dee3

window.open("http://" + location.hostname)
console.log(location.hostname)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question