繁体   English   中英

有没有办法触发使用php和javascript从Firefox浏览器打开IE窗口?

[英]is there a way to trigger an IE window to open from firefox browser using php and javascript?

我使用simpletest作为我的php单元测试框架。

我将所有测试用例都放在一个all_tests.php文件中

但是,由于我们的开发人员倾向于使用firefox运行all_tests.php,因此我们倾向于漏掉特定于浏览器的失败案例,尤其是ie7。

有没有一种方法,当有人在firefox中浏览我们的all_tests.php时,它将自动触发为同一页面打开的ie窗口?

有一种方法,但是浏览器会在允许之前请求许可。

您可以使用此脚本打开Internet Explorer(但请注意,只有在用户接受安全警告后,该脚本才有效)

function runExeOnMozilla(path/*as string*/,args/*as array*/) {
    try{
        netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
        var file = Components.classes["@mozilla.org/file/local;1"]
                    .createInstance(Components.interfaces.nsILocalFile);
            file.initWithPath(path);
        var process = Components.classes["@mozilla.org/process/util;1"]
                    .createInstance(Components.interfaces.nsIProcess);
            process.init(file);
            process.run(false, args, args.length);
    } catch(err){
        alert('access denied');
    }
}

编写打开所有窗口的命令批处理文件。

@echo off
set URL="http://example.com/"
cd "C:\Program Files\Internet Explorer"
iexplore %URL%
cd "C:\Program Files\Mozilla Firefox"
firefox %URL%

并不是我所知道的-如果网页可以在硬盘驱动器上运行任意程序,那将是一个安全漏洞。

您也许可以编写一个简单的Firefox扩展来做到这一点,或者,如果您使用的是Windows,则以某种方式使用(或修改) IETAb

除了可能制作(或使用现有的)插件外,我会说不。 这将构成严重的安全威胁。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM