0

I need to implement something similar to this answer https://stackoverflow.com/a/41749105/1004374 but I have several issues. I changed it slightly so be able to pass arguments into the url:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>openie</title>
</head>
<body>
  <h1>Hello world!</h1>
  <a href="openie:https://www.google.com/">Google1</a>
  <a href="openie:https://www.google.com/?word=abc&word2=abc2">Google2</a>
</body>
</html>

and changed reg script:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\openie]
"URL Protocol"="\"\""
@="\"URL:OPENIE Protocol\""

[HKEY_CURRENT_USER\Software\Classes\openie\DefaultIcon]
@="\"explorer.exe,1\""

[HKEY_CURRENT_USER\Software\Classes\openie\shell]

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

[HKEY_CURRENT_USER\Software\Classes\openie\shell\open\command]
@="cmd /k set myvar= & call set myvar=\"%1\" & call set myvar=%%myvar:openie:=%% & call \"C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe\" %%myvar%% & exit /B"

The only update is shielding of %1 argument:

myvar=\"%1\

This is needed to pass arguments with &. Otherwise will be copied url until first ampersand:

openie:https://www.google.com/?word=abc&word2=abc2

All is fine when you click the link first time. When IE is already opened url is copied incorrectly with encoded quotes inside it and automatically added http in the begining:

http://%22https//www.google.com/?word=abc&word2=abc2"

I realize that issue with cmd script inside but cannot guess what should be changed to be able to pass arguments and click links many times.

Dmitrii Borovoi
  • 2,814
  • 9
  • 32
  • 50

1 Answers1

0

Not found a good way to modify the script to accept the '&'. but as a workaround, I suggest you could encode the url, and change the '&' to '%26', the link as below:

<a href="openie:https://www.google.com/?word=abc%26word2=abc2">Google2</a>

Then, in the destination page, you could decode the url and change '%26' to '&', then, split the string and get the parameters.

More details, please refer to the HTML URL Encoding.

Zhi Lv
  • 18,845
  • 1
  • 19
  • 30