Is it possible to open custom URL scheme with Google Chrome?

Viewed 46163

I have protocol (like http) with scheme managed with 3rd party App registered in Mac OS X. I.e, x-someapp://someaction or something like that.

How can I open this URL with Google Chrome? By default, Chrome starts searching in Google engine instead launching App and passing URL handling to it...

Safari launches some registered App. And it is right thing.

Firefox and Opera asks what to do... and I can launch App also.

But Chrome... Doesn't ask.

I even tried to write some HTML page with JavaScript inside to send XHttpRequest:

function _httpExecuteCallback()
{
 if (httpRequestCallbackFunction != null) {
  if (httpRequest.readyState == 4) {
   if (httpRequest.status == 200) {
    httpRequestCallbackFunction();
    httpRequestCallbackFunction = null;
   }   
  }
 }
}

function _httpGet(url, callbackFunction)
{
 httpRequest = false;
 httpRequestCallbackFunction = callbackFunction;
 httpRequest = new XMLHttpRequest();
 httpRequest.onreadystatechange = _httpExecuteCallback;
 httpRequest.open('GET', url, true);
 httpRequest.send(null);
}


_httpGet('x-someapp://test',function(){})

No results also...

6 Answers

I found the solution that works with Chrome. I use the IFRAME-way.

Example (with JQuery):

$("body").append('<span id="__protoProxy"></span>');

function queryWord(aWord)
{
 var protoProxy = document.getElementById('__protoProxy');
 if (protoProxy)
 {   
  var word = aWord.replace('"','\"');
  protoProxy.innerHTML = '<div style="display:none;"><iframe src="x-myproto://query?' + word + '"></iframe></div>';
 }
}

queryWord('hello');

If Chrome does not recognize the URL scheme, it defaults to a search.

This is what I see in Safari: alt text http://img62.imageshack.us/img62/6792/clipboard02oh.jpg

and in Firefox:

alt text http://img138.imageshack.us/img138/9986/clipboard04xk.jpg

I believe the reason why Chrome defaults to search is that there are special google searches that use the colon.

E.g:

  • define: dictionary
  • filetype:pdf google chromium

This is one of the annoyances I have with Firefox, I have to jump to the "search box" rather than the address bar to execute these types of searches. Since Chrome does not have a separate search box like Firefox, IE and Safari have, this functionality is required.

Ajax requests won't get you around this.

Related