How to open URL in the same window and tab in javascript

Posted by Wei Xia on December 17, 2017

Question:

I want to open an URL in the same window without opening a new tab.

How to do this?

Answer:

We need to add the following attribute.

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

If the attribute doesn’t have "_self", it will oepn this URL in a new window/tab.

Reference


This is the end of post