简体   繁体   中英

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM