Back

Explore Courses Blog Tutorials Interview Questions
0 votes
4 views
in Web Technology by (20.3k points)

I want to open a link in the same window and in the same tab that contains the page with the link.

When I try to open a link by using window.open, then it opens in a new tab—not in the same tab in the same window.

1 Answer

0 votes
by (40.7k points)

You just have to use the name attribute like this:

window.open("https://www.youraddress.com","_self")

Note: Url should be prepended with the protocol. Without it tries to open the relative URL. Tested in Chrome 59, Firefox 54 and IE 11.

Related questions

Browse Categories

...