如何使Internet Explorer正确处理自定义协议处理程序? [英] How do I get Internet Explorer to handle custom protocol handlers correctly?

查看:87
本文介绍了如何使Internet Explorer正确处理自定义协议处理程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开发一个在ssh://0.0.0.0类型的URL上打开PuTTY的网站.我在Chrome和Firefox中使用了此功能,但是在Internet Explorer中出现以下错误:

I would like a website I am developing to open PuTTY on ssh://0.0.0.0 type urls. I got this feature working in Chrome and Firefox, but get the following errors in Internet Explorer:

Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access this item.

其次:

Unable to open this helper application for ssh://0.0.0.0/.

The protocol specified in this address is not valid. Make sure the address is correct, and try again.

这是我的注册表项:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\ssh]
@="URL:SSH Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\ssh\shell]

[HKEY_CLASSES_ROOT\ssh\shell\open]

[HKEY_CLASSES_ROOT\ssh\shell\open\command]
@="cmd /k set in=\"%l\" & call set in=%%in:ssh:=%% & call set in=%%in:/=%% & call \"C:\\Program Files (x86)\\PuTTY\\putty.exe\" %%in%% & exit"

我做了一个快速实验,看来问题出在cmdcall上.删除这些内容后,即可获得预期的结果.但是,我仍然需要像PuTTY一样进行字符串操作(对于使用RealVNC VNC Viewer的vnc url来说,情况也是一样)只希望主机没有协议前缀.

I did a quick experiment, and it looks like the issue is due to cmd and call. As soon as I remove those, I get the expected outcome. However, I still need to do the string manipulation as PuTTY (and an identical situation for vnc urls using RealVNC VNC Viewer) only expects the host without the protocol prefix.

似乎是cmd引起问题的唯一原因. call可以用于预期的行为.

It seems to be cmd only that is causing the issue. call can be used with the expected behavior.

推荐答案

我猜Internet Explorer调用cmd.exe存在权限问题.相反,我必须完全从PowerShell开始.这是工作注册表项,在网上我发现的一些变通办法中完全没有显示其他脚本或PuTTY程序修改:

I guess there is a permissions issue with cmd.exe being called by Internet Explorer. Instead, I had to start entirely over with PowerShell. Here is the working registry keys with absolutely no additional scripts or PuTTY program modifications that are shown in some workarounds I found online:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\ssh]
@="URL:SSH Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\ssh\shell]

[HKEY_CLASSES_ROOT\ssh\shell\open]

[HKEY_CLASSES_ROOT\ssh\shell\open\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -Command \"$uri = [System.Uri]'%l';&\"${env:ProgramFiles}\\PuTTY\\putty.exe\" -P $uri.Port $uri.GetComponents([System.UriComponents]::UserInfo -bor [System.UriComponents]::Host, [System.UriFormat]::UriEscaped)\""

我现在可以从所有三个主要浏览器打开SSHVNC链接.

I can now open SSH and VNC links from all three major browsers.

这篇关于如何使Internet Explorer正确处理自定义协议处理程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆