10 examples of 'window location href new tab' in JavaScript

Every line of 'window location href new tab' 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
this disclaimer
23function openTab(url) {
24 console.log('create OpenNewTab Func for ', url);
25 url = chrome.extension.getURL(url)
26 return function (tab){
27 console.log('EVENT click browserAction', tab, arguments);
28 var createProperties = {
29 url:url
30 };
31 chrome.tabs.create(createProperties, function () {
32 console.log('EVENT new browserAction - windowOpen', arguments);
33 });
34 }
35};
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

14function open_in_new_tab(url )
15{
16 var win=window.open(url, '_blank');
17 win.focus();
18}
1function openintab(url) {
2 var togo = window.location.protocol + "//" + window.location.host + "/editor?uuid=" + url + "&profile=jbpm&pp=";
3 window.open(togo, '_blank');
4}
120function openTabOrWindow(url)
121{
122 try {
123 var gBrowser = window.opener.getBrowser();
124 gBrowser.selectedTab = gBrowser.addTab(url);
125 }
126 catch (e) {
127 window.open(url);
128 }
129}
10function open_tab(url) {
11 var win = window.open(url, '_blank');
12 if (win) {
13 //Browser has allowed it to be opened
14 win.focus();
15 } else {
16 //Browser has blocked it
17 alert('Please allow popups for this website');
18 }
19}
85async goto(url) {
86 return browser.tabs.update(this.id, { url });
87}
93function openUrlNewTab(url)
94{
95 chrome.tabs.create({url: url});
96}
231function after_setWindowLocation(win, url) {
232 goog.dom.safe.setLocationHref(win.location, url);
233}
9function open_tab(url, mode) {
10 action = {"createProperties":{"url":url},"mode":mode};
11 if(mode == "newtab")
12 action.createProperties.active = false;
13 chrome[runtimeOrExtension].sendMessage(action);
14}
17function openAndCloseTab(url) {
18 chrome.tabs.create({ url }, tab => {
19 const removeTab = () => {
20 chrome.windows.onFocusChanged.removeListener(removeTab);
21 if (tab && tab.id) {
22 chrome.tabs.remove(tab.id, () => {
23 if(chrome.runtime.lastError) console.log(chrome.runtime.lastError); // eslint-disable-line no-console
24 else if (chrome.devtools && chrome.devtools.inspectedWindow) {
25 chrome.tabs.update(chrome.devtools.inspectedWindow.tabId, {active: true});
26 }
27 });
28 }
29 };
30 if (chrome.windows) chrome.windows.onFocusChanged.addListener(removeTab);
31 });
32}

Related snippets