4 examples of 'window open _blank' in JavaScript

Every line of 'window open _blank' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
11export function windowOpen(url, { name, height = 400, width = 550 }) {
12 const left = (window.outerWidth / 2)
13 + (window.screenX || window.screenLeft || 0) - (width / 2);
14 const top = (window.outerHeight / 2)
15 + (window.screenY || window.screenTop || 0) - (height / 2);
16
17 const config = {
18 height,
19 width,
20 left,
21 top,
22 location: 'no',
23 toolbar: 'no',
24 status: 'no',
25 directories: 'no',
26 menubar: 'no',
27 scrollbars: 'yes',
28 resizable: 'no',
29 centerscreen: 'yes',
30 chrome: 'yes',
31 };
32
33 return window.open(
34 url,
35 platform.name === 'IE' && parseInt(platform.version, 10) < 10 ? '' : name,
36 Object.keys(config).map(key => `${key}=${config[key]}`).join(', ')
37 );
38}
81export function openWindow(url) {
82 if (isIE11() || isFirefox()) {
83 const win = window.open();
84 win.opener = null;
85 win.location = url;
86 return;
87 }
88 const anchor = document.createElement('A');
89
90 anchor.setAttribute('rel', 'noreferrer nofollow noopener');
91 anchor.setAttribute('target', '_blank');
92 anchor.href = url;
93
94 return anchor.click();
95}
15function doOpen(){
16 var fce = document.getElementById('pickFolderCollection');
17 var fc = (fce) ? fce.value : null;
18 var fne = document.getElementById('pickFolderName');
19 var fn = (fne && fne.value && fne.value.length) ? fne.value : null;
20 if(fc && fn) location.href = 'browse/'+ fc + '/' + fn;
21 else panelAlert('Which folder would you like to View?<p>Click a folder\'s name to select it, then click <b>View Messages</b>.');
22 return false;
23}</p>
244function open_new_win(url, options) {
245 options = options || '';
246 return window.open(url, '_blank', options);
247};

Related snippets