Programatically open the URL in new tab in chromium browser using javascript

左心房为你撑大大i 提交于 2019-12-11 19:21:46

问题


I have a web application where I have four/five icons in the default page. On click of these icons i am redirecting to some URL in new tab of already opened chromium browser instance using javascript. Below is the javascript code snippet that I am using to launch the URL in new tab of already opened chromium browser instance. Here I am manually clicking the icon

window.open(myURL, '_blank');

But the issue is when I am trying to open the same URL using the same code and programatically triggering the same code to open the URL in new tab, it opes up as a Pop Up but not in a tab. Below is how I am trying to pragmatically open the URL. I am calling the click event of the Icon in the default page using some script rather than manually clicking the icon.

$('#myIconId').click();

If somebody could please help me out. TIA


回答1:


give a try to use

<a href="some url" target="_newtab">content of the anchor</a>

Although You shouldn't force user to open new pages or new tab without showing them a hint on what is going to happen before they click on the link.

Above code may or may not work on all browser, please test before making live.

UPDATE

Ref : Programmatically open new pages on Tabs



来源:https://stackoverflow.com/questions/20495467/programatically-open-the-url-in-new-tab-in-chromium-browser-using-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!