1

I have followed the instructions in this Stackoverflow thread to create a custom protocol handler in Windows 7 that will open any URL prefixed with "ie:" in Internet Explorer. As explained in Microsofts post on custom protocol handlers there are issues with how special character are treated, and thus problems passing parameters with URLs.

In the linked thread there is a post by Saurabh which suggests creating a local html file with a script that correctly parses the URL and then redirects to this new updated URL. I haven't gotten this to work.

What works:

  • The protocol handler can open custom URLs (ie:https://www.google.se, ie:file:///C:/ieRedirect.html) from external programs in Internet Explorer.

  • Local files opened with the protocol can launch hardcoded URLs containing parameters (not very useful, see code below)

<html>
 <head>
  <title>
   IE Redirect
  </title>
  <script>
   function testOpenURL(){
    window.open('https://www.google.se/search?q=stackoverflow', '_self');
   }
  </script>
 </head>
 <body onload="testOpenURL()">

 </body>
</html>

Questions:

  • Is there a way to get Saurabh's workaround to work and pass one or more parameters with the URL?

  • Is there another method to pass parameters through a custom protocol handler?

Any suggestions are highly appreciated. You can find my reg file below.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\ie]
"URL Protocol"="\"\""
@="\"URL:IE Protocol\""

[HKEY_CURRENT_USER\Software\Classes\ie\DefaultIcon]
@="\"iexplore.exe,1\""

[HKEY_CURRENT_USER\Software\Classes\ie\shell]

[HKEY_CURRENT_USER\Software\Classes\ie\shell\open]

[HKEY_CURRENT_USER\Software\Classes\ie\shell\open\command]
@="cmd /C set myvar=%1 & call set myvar=%%myvar:ie:=%% & call start /separate iexplore %%myvar%% & exit"
Dan
  • 11
  • 2

1 Answers1

0

I've also failed modifying the protocol sufix on command string vaue, so I've get one different way to solve this problem:

  • Create a page on your server (e.g. http: //<your.domain>/redirect/index.php) like this:
<?php
   $url = isset($_GET['url']) ? $_GET['url'] : die('Access denied');
   $url = str_replace('ie', 'http', $url);
   header('Location: ' . $url);
   die();
?>
  • Set the command key value as "iexplore.exe" "http://<your.domain>/redirect?url=%1"
lluisma
  • 101
  • 1
  • 6