javascript open new tab but stay on current page

It's free to sign up and bid on jobs. You can't open tabs in the background using javascript because this is set in the user's preferences in about:config , which you have no control o... Below is the method that closes the current window tab: Before going to discuss further, I think you should aware of the fact that window.close () method will able to close only the tab that is open by using the window.open () method. So, to close the current tab in javaScript, it must have to be opened by using the window.open () method. location.href; // current page url addresss. Suppose we have a web page that is opened on a tab of a browser window. Close current tab in browser window using JavaScript Here coder in this blog post we learn how to open a new tab in javascript on button click. Here's an idea: