当前位置: 移动技术网 > IT编程>开发语言>JavaScript > 在chrome浏览器中调用IE浏览器并访问(openIE.reg自定义协议)

在chrome浏览器中调用IE浏览器并访问(openIE.reg自定义协议)

2019年10月16日  | 移动技术网IT编程  | 我要评论

在谷歌浏览器中有4种方法调用ie浏览器。如下:


 

  1. c++ socket通过浏览器在ie中打开指定url ;
  2. vb生成exe,url访问exe启动ie并打开指定url ;
  3. 通过socket实现通过http调用ie浏览器并打开指定url ;
  4. chrome自定义协议。

 

今天我们就来说一下使用chrome自定义协议打开ie浏览器并访问指定页面。

当然,有很多网友都写过,我这里就借花献佛了。

使用方式:

  1. 添加一个注册表;
  2. 在chrome里面用a标签编写一个跳转链接;
  3. 优化用户体验。

 

添加注册表

在桌面上建立一个openie.reg(将txt改为reg)文件,点击编辑打开,在里面写入如下内容来进行自定义协议(注册表),完成后双击运行文件。

windows registry editor version 5.00

[hkey_classes_root\openie]

@="url:openie 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 & call set m=%%m:openie:=%% & call \"c:\\program files\\internet explorer\\iexplore.exe\" %%m%% & exit"

写完后双击运行文件。


 

在chrome里面用a标签编写一个跳转链接

<a href="openie:www.baidu.com">点我使用外部协议运行ie打开百度</a>

这样就在chrom里面调用ie访问指定的网站。

这里有个不好的用户体验,他会弹出一个黑窗窗(cmd的命令框),解决方法如下:


 

优化用户体验

新建一个alert文件夹(协议名称)(注意:所有操作完成后alert文件夹重命名为alert.exe并双击运行

进入文件夹,建立三个文件,分别为alert.reg、openie.bat、runreg.bat,里面写入内容如下

alert.reg

windows registry editor version 5.00

[hkey_classes_root\alert]
@="url:alert protocol"
"url protocol"=""

[hkey_classes_root\alert\defaulticon]
@="iexplore.exe,1"

[hkey_classes_root\alert\shell]

[hkey_classes_root\alert\shell\open]

[hkey_classes_root\alert\shell\open\command]
@="cmd /c set m=%1 & \"c:\\program files\\alert\\openie.bat\" %%m%% & exit"

openie.bat

@echo off
set m=%m:alert:=%
set m="%m:separator=&%"
start "" "c:\\program files\\internet explorer\\iexplore.exe" %m%
exit

runreg.bat

regedit /s alert.reg

 

建立完后,将文件夹alert改为alert.exe并双击运行。这样自定义协议就完成了,然后就可以直接在chrome里面调用ie打开指定网页了。

原文地址:

转载请注明地址,谢谢!

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网