Created
February 19, 2015 19:31
-
-
Save jxpx777/2eb0f5fbdfbd8800a356 to your computer and use it in GitHub Desktop.
The goal is to open a URL in the active tab. If one does not exist, we should open a new tab for it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function openURLInActiveTab(url){ | |
if (tabs.activeTab.url === undefined) { | |
tabs.open({url: url, onOpen: function onOpen(tab) { console.log("[GLOBAL]: Opened tab: " + tab); tab.activate(); tab.url = url; }}); | |
} | |
else { | |
tabs.activeTab.url = url; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment