如何在Internet Explorer中修复“SCRIPT424:所需对象:'环境'”

问题描述 投票:0回答:1

我正在尝试在新的浏览器会话中启动IIS webapp,我更喜欢跨平台,但IE只是可以的;我询问了MSDN,他们推荐了类似下面的代码,但它找不到环境变量,MSFT在2天内没有回复我。

我需要导入一些东西吗?有一个很好的vbscript教程吗?

<script type="text/vbscript">
        function VBLaunch(ByVal url)
            ProductDir= Environment.value("ProductDir")
            IF (Instr(1,ProductDir,"(x86)"))>0 then
                SystemUtil.Run "C:\Program Files (x86)\Internet Explorer\IEXPLORE.EXE", "-noframemerging " &  URL'  Launch Internet explorer and enter given URL
            Else
                SystemUtil.Run "C:\Program Files\Internet Explorer\IEXPLORE.EXE","-noframemerging " & URL'  Launch Internet explorer and enter given URL
            End if
        end function
</script>

这可能是XY问题的一个实例,所以如果有一个更好的方法是不能重写大部分应用程序来启动IIS webapp,那么它获得一个不同的Session cookie作为当前选项卡,我会没问题。

javascript internet-explorer web-applications vbscript
1个回答
0
投票

感谢Lankymart指出VBscript MSFT让我使用某种测试框架,我环顾四周,最终想出了这个

<script type="text/vbscript">
 function VBLaunch(ByVal url)

     Set WshShell = CreateObject("WScript.Shell")
     WshShell.Run "iexplore.exe " & url

 end function
</script>

这确实有效,但需要设置较低的安全级别并允许activex;所以我不推荐这种方法。

© www.soinside.com 2019 - 2024. All rights reserved.