Chrome, Javascript, window.open in new tab
You can't directly control this, because it's an option controlled by Internet Explorer users.
Opening pages using Window.open with a different window name will open in a new browser window like a popup, OR open in a new tab, if the user configured the browser to do so.
EDIT:
A more detailed explanation:
1. In modern browsers, window.open will open in a new tab rather than a popup.
2. You can force a browser to use a new window (‘popup’) by specifying options in the 3rd parameter
3. If the window.open call was not part of a user-initiated event, it’ll open in a new window.
4. A “user initiated event” does not have to the same function call – but it must originate in the function invoked by a user click
5. If a user initiated event delegates or defers a function call (in an event listener or delegate not bound to the click event, or by using setTimeout for example), it loses it’s status as “user initiated”
6. Some popup blockers will allow windows opened from user initiated events, but not those opened otherwise.
7. If any popup is blocked, those normally allowed by a blocker (via user initiated events) will sometimes also be blocked.
Some examples…
Forcing a window to open in a new browser instance, instead of a new tab:
window.open('page.php', '', 'width=1000');
The following would qualify as a user-initiated event, even though it calls another function:
function o(){
window.open('page.php');
}
$('button').addEvent('click', o);
The following would not qualify as a user-initiated event, since the setTimeout defers it:
function g(){
setTimeout(o, 1);
}
function o(){
window.open('page.php');
}
$('button').addEvent('click', g);
Open a URL in a new tab (and not a new window)
Nothing an author can do can choose to open in a new tab instead of a new window; it is a user preference. (Note that the default user preference in most browsers is for new tabs, so a trivial test on a browser where that preference hasn't been changed will not demonstrate this.)
CSS3 proposed target-new, but the specification was abandoned.
The reverse is not true; by specifying certain window features for the window in the third argument of window.open()
, you can trigger a new window when the preference is for tabs.
window.open opening tabs and windows in Google Chrome
A have solved this problem and create a gist. It open 3 links in tabs.
Related Topics
How to Create Multidimensional Array
How to Programatically Select an HTML Option Using JavaScript
Stringify (Convert to JSON) a JavaScript Object with Circular Reference
How to Find Indices of All Occurrences of One String in Another in JavaScript
The Entity Name Must Immediately Follow the '&' in the Entity Reference
How to Create Dynamic Variable Names Inside a Loop
How to Convert Dd/Mm/Yyyy String into JavaScript Date Object
React Hooks Usestate() with Object
Call a Function After Previous Function Is Complete
React Component Initialize State from Props
Get Client Time Zone from Browser
What Is the Order of Execution in JavaScript Promises
Calling a JavaScript Function Named in a Variable
Fetch: Reject Promise and Catch the Error If Status Is Not Ok
Using _ (Underscore) Variable with Arrow Functions in Es6/Typescript