1

I'm making a chrome extension that redirects you to a specific url every time you open a new tab. The code I'm using is down below. However it is really annoying that whenever I open a new tab, it does it's job in redirecting me to the url but it does not highlight the omnibox!! This means it really frustrating to do my searches as this address bar is not highlighted. I know Control + L is an option but we are all so used to not doing this.

When I open a new tab, I can see the omnibox being highlighted but then it it goes away right afterwards. Is there a way keep this address bar highlighted before, during and after the redirect?

I know this is possible because this extension, Tab for a cause redirects you to their custom url while still keeping the onmibox highlighted!!

Thank you in advance!

I'm using manifest version 2.

manifest.json

{
    "name": "...",
    "manifest_version": 2,
    "version": "1.0",
    "description": "...",
    "chrome_url_overrides": {
        "newtab": "my.html"
    },
    "permissions": [
        "tabs",
    ]
}

my.html

<!DOCTYPE html>
<html>
    <head>
        <title>...</title>   
        <script type="text/javascript" src="code.js">
        </script>
    </head>
    <body>    
    </body>
</html>

code.js

window.location.href = "https://website-of-interest.com/"
mikemaccana
  • 110,530
  • 99
  • 389
  • 494
Venkata P.
  • 11
  • 1

0 Answers0