Google-chrome – Open chrome and launch the settings page

command linegoogle-chrome

Does anyone know how to launch chrome and immediately open a "chrome url"?

I'm trying to make a shortcut like this, but its not working when I tried. it only accepts http:// urls

GoogleChromePortable.exe "chrome://settings/"

Thanks in advance who can help out

Best Answer

OK, so I finally figured out a "hack". This hack requires creating an extension to handle the request. I already tried quite a few attempts to "hijack" Chrome with an easier way but seems that Chrome is secure enough to stop me from doing that and this is the closest I can get.

First, create an empty directory somewhere accessible on the hard drive.

Create a file manifest.json with the following content:

{
    "name": "Open Chrome URLs",
    "version": "1.0",
    "manifest_version": 2
}

Create a file open.html with the following content:

<html>
<head>
<title>Open Chrome URLs</title>
<script type="text/javascript" src="open.js"></script>
</head>
<body>
</body>
</html>

Create a file open.js with the following content:

window.addEventListener("load", function(){
    var key = "secretKey"; // replace "secretKey" with your own secret key
    if(window.location.search == "?key=" + key && window.location.hash.length > 1){
        chrome.tabs.update({
            'url': "chrome://" + window.location.hash.substr(1) + "/"
        });
    }else{
        document.body.appendChild(document.createTextNode("Invalid"));
    }
});

Replace the secret key with your own if wanted.

Then, open the Extensions page (chrome://extensions/).

Check the "Developer mode" checkbox and click "Load unpacked extension" and select the directory that you just created.

You should now see a new extension appeared.

New extension

Copy the extension id.

Finally, start Chrome with the following URL as the parameter.

chrome-extension://nihlceAnywayPutTheExtensionIdHere/open.html?key=secretKey#settings

Replace the first part with the extension id with the one you just copied.

Also replace the secretKey with the one you set above.

You can also use most of the other Chrome URLs instead of settings.

Note: you need a shortcut to Chrome instead of an Internet link.

Good luck!

Related Question