-2

The following <a> element would open www.example.com in a different tab/window than the current one:

<a href="//www.example.com" target="TabOne">Link</a>

However, users would be brought to the newly opened tab/window. How can I open URL in new window/tab without leaving the current one?

nalzok
  • 14,965
  • 21
  • 72
  • 139
  • 1
    Possible duplicate of [automatic open pop-up new window using Javascript](https://stackoverflow.com/questions/19293014/automatic-open-pop-up-new-window-using-javascript) – G J May 29 '17 at 13:42
  • 1
    Know that Firefox has an option setting "When you open a link in a new tab, switch to it immediately", so with this option set, staying at the same window may still be limited. – Paul T. May 29 '17 at 13:47

2 Answers2

0

Use:

<a href="//www.example.com" target="_blank">Link</a>
Jason H
  • 4,996
  • 6
  • 27
  • 49
  • Sadly I hate MAC and not sure why Safari cannot use 'standard html'. The above will work in IE, Edge, Chome, and Firefox. – Jason H May 29 '17 at 14:06
0

Open in current tab:

<a href="www.example.com" target="_self">title</a>

Open in another tab:

<a href="www.example.com" targer="_blank">title</a>

Hope this help =))

Jason H
  • 4,996
  • 6
  • 27
  • 49
Steven Tran
  • 104
  • 1
  • 8