-2

I have noticed one thing when you press ctrl button + click a button or a link a new windows open in the same browser, I want same situation like that, I already studied the window.open() method which open a new window but with the latter method i am directed to the new window, I just to stay on the first page , not the one popups.

Na Dim Kh An
  • 31
  • 1
  • 1
  • 8
  • 1
    Possible duplicate of [How to Stay on Current page while using window.open](http://stackoverflow.com/questions/15299617/how-to-stay-on-current-page-while-using-window-open) – Mike Cluck Mar 29 '16 at 17:25
  • Possible duplicate of [Open a URL in a new tab (and not a new window) using JavaScript](http://stackoverflow.com/questions/4907843/open-a-url-in-a-new-tab-and-not-a-new-window-using-javascript) – MattSizzle Mar 29 '16 at 17:27

1 Answers1

0

You can not decide how the user's browser handles the open window event, but to trigger the new window or new tab (based on the user's settings) you can do the following:

window.open(url,'_blank');

The _blank indicates the new window or tab to the browser.

MattSizzle
  • 3,145
  • 1
  • 22
  • 42