简体   繁体   中英

onInstalled chrome runtime debugging?

chrome.runtime.onInstalled.addListener(function(){
    chrome.tabs.update(null, {url: ''});
    alert();
});

Above code doesn't work when I install my extension in developer mode. I want to update the active tab to be a blank tab once my extension installed in chrome web store.

That's an invalid URL, that's why it does not work.

You can't just "erase" the URL without navigating to what you supply as the new URL.

If you are trying to navigate to the New Tab page, it has a URL (that's normally hidden) chrome://newtab . If you want a blank page in terms of content, it's about:blank .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM