+ 11
How To Open URL in same window and in same tab ???
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 new tabânot in the same tab in the same window.
7 Answers
+ 23
If you want to do this in HTML:
<a href = "page.html" target = "_self"> </a>
Else, use Javascript:
window.open('page.html', '_self');
Bye. :)
+ 14
Thank You @Maz đ
+ 13
Thank You @Oliver
+ 13
Thank You @Amit
+ 5
try to use location.href = "http://example.com";
+ 3
target=_blank is used to open link in new tab, what if we remove target attribute, won't that help in html, and In JavaScript by default would be different like opening in new tab ..... that's why it is not working.
0
you can also use, window.location.replace, to tab in the same window