在chrome瀏覽器中呼叫IE瀏覽器並訪問(openIE.reg自定義協議)
阿新 • • 發佈:2019-10-16
在谷歌瀏覽器中有4種方法呼叫IE瀏覽器。如下:
- c++ socket通過瀏覽器在ie中開啟指定url ;
- vb生成exe,url訪問exe啟動ie並開啟指定url ;
- 通過socket實現通過http呼叫IE瀏覽器並開啟指定url ;
- chrome自定義協議。
今天我們就來說一下使用chrome自定義協議開啟ie瀏覽器並訪問指定頁面。
當然,有很多網友都寫過,我這裡就借花獻佛了。
使用方式:
- 新增一個登錄檔;
- 在chrome裡面用a標籤編寫一個跳轉連結;
- 優化使用者體驗。
添加註冊表
在桌面上建立一個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開啟指定網頁了。
原文地址:https://www.cnblogs.com/xiongze520/p/11684570.html
轉載請註明地址,謝謝!
&n