使用url protocol在浏览器中打开本地应用

1.新建文件 openIE.reg

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\openIE]
@="URL:Alert Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\openIE\DefaultIcon]
@="iexplore.exe,1"

[HKEY_CLASSES_ROOT\openIE\shell]

[HKEY_CLASSES_ROOT\openIE\shell\open]

[HKEY_CLASSES_ROOT\openIE\shell\open\command]
@="cmd /c set m=%1 & \"C:\\Program Files\\openIE\\openIE.bat\" %%m%% & exit"

// iexplore.exe 要跳转的应用
// 这里的openIE可以改为其他名字,与第四步调用时一致即可
// 最后一行 C:\\Program Files\\openIE 为第二步openIE.bat的路径,可以改为其他地址

2.C:\Program Files下新建文件夹openIE,文件夹内新建文件openIE.bat

@echo off
set m=%m:openIE:=%
set m="%m:separator=&%"
start "" "C:\\Program Files\\Internet Explorer\\iexplore.exe" %m% 
exit

 // 第四行为要跳转的应用安装路径  

3.双击运行openIE.reg,添加注册表
4.跳转应用

// 跳转应用
top.location = "openIE:"
// 跳转应用并打开本地文件
top.location = "openIE:file:///C:/Users/admin/Desktop/index.html"
// 跳转应用并打开网址
top.location = 'openIE:https://www.baidu.com'
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值