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
javascript google-chrome google-chrome-extension tabs


source to share


No one has answered this question yet

Check out similar questions:

7494
How can I remove a specific element from an array in JavaScript?
5722
How can I remove a property from a JavaScript object?
949
How to remove border (outline) around text / input fields? (Chromium)
675
Remove blue border from css custom-styled button in chrome
593
How do I set a JavaScript breakpoint from code in Chrome?
586
Refreshing address bar with new url without hash or reloading the page
513
How do I change the color of the title bar and address bar in the newest version of Chrome to Lollipop?
319
Google Chrome redirects localhost to https
1
How to bring focus to the address bar of Google Chrome (OmniBox)?
0
How do I stop focusing a chrome tab?



All Articles
Loading...
X
Show
Funny
Dev
Pics