Chrome extension - update "newtab" and remove focus from the address bar

When I redirect newtab to a new url, the focus in the address bar stays where it is, which is very annoying. If the user removes focus from the chrome window and then back again, a giant suggestion window appears below the address bar. How do I change the "newtab" url so that focus moves to the page?

chrome.browserAction.onClicked.addListener(function(tab){

    var url={url:"http://example.com"};

    if( tab.url.toLowerCase() == "chrome://newtab/" )
        chrome.tabs.update(tab.id,url);
    else
        chrome.tabs.create(url);

});

      

+3


source to share





All Articles