function handleClick(tab) { const newUrl = tab.url.replace('https://', 'https+vim://'); console.log(newUrl); newTab = browser.tabs.create({ url: newUrl }); // TODO: close the tab after it's been opened // this doesn't work as it happens too fast and the app isn't open yet //newTab.then(function(ntab) { //browser.tabs.remove(ntab.id); //}) } browser.pageAction.onClicked.addListener(handleClick);