Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
    
Interesting... GoogleChromePortable @ portableapps? –  Alvin Wong Feb 28 '13 at 9:18
    
yes, its from portableapps. I also tried on an installed chrome browser and its not working –  fedmich Feb 28 '13 at 11:54
    
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 Feb 28 '13 at 13:03

2 Answers 2

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.

share|improve this answer
    
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 Feb 28 '13 at 11:56

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!

share|improve this answer
    
Hey 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 Feb 28 '13 at 23:38
    
@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 Mar 1 '13 at 4:10
    
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 Mar 1 '13 at 4:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.