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:
- Click the button to use in the react project window.open Methods open a new page and click the data again
- window.open () several ways to open windows
- New user’s shell, delete prompt ^ H, up and down prompt ^ A ^ B, tab key is useless
- Several ways for Ubuntu to open command line terminal window
- Android Studio – automatically opens the latest project every time you open as
- Click the button to jump to a new window
- JS exception capture: the usage and example analysis of onerror() in window
- Virtual host running ASP error resolution: HTTP/1.1 New Application Failed when allowSessionState is set to false in web.config
- Idea installation vue.js After plug-in, new has no Vue component
- After Android studio is installed, open a pop-up window to prompt failed to load JVM DLL XXX
- Idea | change the default configuration of idea to open a new project
- Open virtuakbox and failed to acquire the VirtualBox com appears object.The application will now terminate.
- Error 72 error LNK1181: cannot open input file ‘opencv_world310.lib’ E:\VC-WORK\FaceTrainVS2010_new\
- Android set request window feature( Window.FEATURE_ NO_ Title) invalid solution
- Vs2017 cannot open the source file “XXX. H” by adding a file name after creating a new class
- Request window feature for Android Development( Window.FEATURE_ NO_ Title) does not take effect
- How to remove the title bar (using the request window feature)( Window.FEATURE_ NO_ Title); why it fails)
- Declarative development tab in Vue
- [Android] using request window feature( Window.FEATURE_ NO_ Title) method to remove the title invalid solution
- Display spaces and tab symbols in vscode