Chrome 中打开 IE 浏览器,跳转到指定页面并传递参数

https://blog.csdn.net/zhaoyunfei1/article/details/104899996?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-5&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-5

为方便使用,使用winrar将指定目录打包为exe,参考文档《Windows-winrar打包exe.md》

  1. 示例

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>调用本地 IE 浏览器打开百度首页</title>
    </head>
    <body>
    <a href="openIE://www.baidu.com?a=1&b=2" />百度一下
    </body>
    </html>
  2. runreg.bat

    1
    REGEDIT /S openIE.reg
  3. openIE.reg

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    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]
    @="\"C:\\Program Files\\openIE\\openIE.bat\" \"%1\""
  4. openIE.bat

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    @echo off
    set m=%1%
    set m=%m:openIE:=%
    IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
    start "" "C:\\Program Files\\Internet Explorer\\iexplore.exe" %m%
    ) ELSE (
    IF "%PROCESSOR_ARCHITECTURE%" == "X86" (
    start "" "C:\\Program Files\\Internet Explorer\\iexplore.exe" %m%
    ) ELSE (
    start "" "C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe" %m%
    )
    )
    exit

IE 浏览器打开其他浏览器

1
2
3
4
5
function start(){ 
var objShell = new ActiveXObject("wscript.shell");
var cmd= "cmd /c start C:/\"Program Files (x86)\"/Google/Chrome/Application/chrome.exe \"http://www.baidu.com\"";
objShell.Run(cmd,0,true);
}