0 votes
1 view
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.3k 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

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...