Opening url in new tab

前端 未结 2 2024
后悔当初
后悔当初 2020-12-12 03:13

I am trying to open a new tab with javascript.
How to write it so that it would work in chrome, firefox and IE7?
(the pages are on the same domain)

UPD: Le

相关标签:
2条回答
  • 2020-12-12 04:02

    You cannot control how the browser will handle opening new popups / pages. This is entirely handled by the browser. If the user has set their browser up to open new pages/popups in a new window, you cannot force your own page to open in a tab.

    0 讨论(0)
  • 2020-12-12 04:10

    Plain HTML:

    <a href="newpage.html" target="_blank">click here</a>
    

    Javascript:

    window.open("newpage.html", "_blank");
    

    But keep in mind what psynnott said.

    0 讨论(0)
提交回复
热议问题