Open chrome and launch the settings page

4

4

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

fedmich

Posted 2013-02-28T08:35:39.830

Reputation: 269

Interesting... GoogleChromePortable @ portableapps? – Alvin Wong – 2013-02-28T09:18:39.583

yes, its from portableapps. I also tried on an installed chrome browser and its not working – fedmich – 2013-02-28T11:54:00.627

Can't find a way. I already tried quite a few attempts to "hijack" Chrome but seems that Chrome is secure enough to stop me :P – Alvin Wong – 2013-02-28T13:03:46.580

Answers

4

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!

Alvin Wong

Posted 2013-02-28T08:35:39.830

Reputation: 870

1Hey Alvin, Thanks for your effort on this. Since I'm also a extension developer. I understand what your codes here are. Nice hack if I may say, but its a bit overkill though. I'm still looking for a simpler commandline solution, but +1 for you already :) – fedmich – 2013-02-28T23:38:20.300

@fedmich Because Chrome did its best on security, you can't simply open chrome://settings/. Even in an extension using window.location.replace("chrome://settings/") fails (try in console :[ ). I can only use chrome.tabs.update to accomplish this. Would like to know if any simpler solution. – Alvin Wong – 2013-03-01T04:10:47.973

Yup, if the "hacked" extension is disabled then this functionality is broken. Let's wait a while, someone else might be able to give another approach. – fedmich – 2013-03-01T04:18:15.303

2

Here’s a very simple AutoHotkey solution:

WinActivate Chrome 
send ^t
sleep 100 
sendraw chrome://settings/ ; any URL works 
sleep 100 
send {enter}

Stenemo

Posted 2013-02-28T08:35:39.830

Reputation: 266

0

The following AutoHotkey script can be used for a variety of Chrome-based browsers.

; This script opens the "About" page in a Chrome-based Web browser
; -------------------------------------
; To use a different Chrome variant, change the following variables
EnvGet, pf, ProgramFiles(x86) ; For 64-bit browsers: ProgramW6432
dir = %pf%\Google\Chrome\Application ; Browser's drive and directory
protocol = chrome ; Start of the URL, and also the name of the Windows process
tabName = New Tab - Google Chrome ; How the browser names new tabs
; -------------------------------------
proc = %protocol%.exe ; Full name of the Windows executable file
app = %dir%\%proc% ; Full path to the browser
winTitle = ahk_exe %proc% ; Identify the window by the executable file's name
Menu, Tray, Icon, %app% ; Use the browser's icon for this script
Process, exist, %proc% ; See whether the browser is already running
If NOT ErrorLevel ; Browser is not currently running, so run it
 Run, "%app%"
WinWait, %winTitle%,, 200
If ErrorLevel
{
 MsgBox, 48, Error, Browser window was not found.`n`nRef: %A_ScriptFullPath%
 Exit, 1
}
WinActivate, %winTitle%
Send ^t ; Open a new tab in the browser
WinWait, %tabName%,, 20
If ErrorLevel ; The new browser tab was not found
 Exit, 1
Sleep, 100
WinActivate, %winTitle%
Send %protocol%://settings/help{ENTER} ; Open the browser's "About" page
Exit

Michael Weiner

Posted 2013-02-28T08:35:39.830

Reputation: 1

0

Once chrome starts, go into the chrome://settings/ Url and then the option for on startup select use a specific URL. Put the chrome settings url there and click ok. You then select the bubble for that option and it will will start to that settings page. Now if you want this to be more of an alias solution simply copy the chrome binary and configs or if you are on mac os x copy the app package and do this with the second version or primary your choice. You should also rename the binary and configs but again there is always more than one way to do it. And then define your shortcut or alias accordingly.

spacedhost

Posted 2013-02-28T08:35:39.830

Reputation: 1

Thanks for helping. but I need a solution in Windows. I need it in a shortcut lnk file. then perhaps later on I could code it up – fedmich – 2013-02-28T11:56:22.153