JS opens a new tab( window.open Application)

js how to open a new TAB

in & lt; a> The tag can be opened by setting target= “_blank”. But sometimes you need Javascript to open a new tag, so how do you do that?Here’s how:
window.open(” http://www.wlzhys.com “); .
or:
Windows open (” http://www.wlzhys.com “, “_blank”); // note that the second parameter
, some people may wonder, window.open() is not used to open a new window, how can you open a new TAB?In fact, the browser will only open a new window when the third property
is specified in window.open() (i.e. the characteristics of the new window). If the third property is not specified, the browser will only open a new TAB in the current window (in IE, if the URL to be opened does not belong to the same main domain name as the URL of the current
page, the new window will be opened; In Chrome, if the window.open() function is called not by mouse and keyboard events, but directly by the page, or via a
timer, etc., then a new window is opened instead of a TAB. In addition, the following applies to < a> The target parameter of the tag also applies to the name parameter of window.open() :

note:
1. In IE, if the domain you want to open does not belong to the same primary domain as the current domain, it will open in a new window (< a> The tag does the same. 2. In Chrome, if the window.open() function is called not by mouse and keyboard events, but either directly by the page or via timers (including those triggered by mouse and keyboard), then a new window is opened instead of a TAB. 3. In a new window or tag, the _parent and _top arguments of window.open() are invalid (valid only in frame). The framename parameter can be set to the name value of the frame in the current page, the name value of the new window, or the name value of the new tag.
[footnote]
window.open(url,target,init); //URL represents the page address; 1. Open the link in the new TAB/page
window.open(‘ http://www.wlzhys.com ‘, ‘Target’, “);

2, open the link
(1) window.open(‘ http://www.wlzhys.com ‘, ‘_self’, “);
(2) window.location.href= ‘http://www.wlzhys.com’;

Read More: