I have a function called in popup.html that creates a tab, inserts a mailto to trigger a local (or gmail) mail event. It's my desire for it to then close itself. I've tried numerous things, but it seems like I need something that does the equivalent of:
tabId = chrome.tabs.query(I DON'T KNOW!);
chrome.tabs.remove(tabId);
here's the current code:
var query = { active: true, currentWindow: true };
function callback(tabs) {
var currentTab = tabs[0];
console.log(currentTab);
}
chrome.tabs.remove(chrome.tabs.query(query, callback));
but it's not working.
if useful, here's how I create the tab (which does work as desired):
chrome.tabs.query({active: true, currentWindow: true}, function(tabs){
getTabs(tabs, function(full_mail_link){
chrome.tabs.create({ url: full_mail_link });
});
});
any help would be greatly appreciated!
I don't know what your getTabs function does. Yet if you know how to find the tab id of the tab you want all you need to do is
chrome.tabs.remove(tabId, optionalCallback);
this must be work:
chrome.tabs.getSelected(null, function(tab) {
chrome.tabs.remove(tab.id);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With