Answer the question
In order to leave comments, you need to log in
How to open the current page in a new tab, and in the old another?
Tell me how, when you click on a link, open the current page in a new tab, and another one in the old one?
Answer the question
In order to leave comments, you need to log in
It can be something like this:
const link = document.querySelector('a.some-link'); // подставьте свой селектор
link.addEventListener('click', event => {
event.preventDefault();
window.open(location.href);
location.assign(link.href);
});
But this behavior is unexpected for the user. And the state of the page in the new tab will be like when loading.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question