Java脚本在IE11中获取错误

时间:2015-07-02 06:40:18

标签: javascript

我的车有2008克莱斯勒服务手册。它曾经在XP中打开OK但无论我做什么都不会在IE11中运行。这是itcToc.js的脚本,我得到了我的错误:

     if (navigator.appName == "Microsoft Internet Explorer")
sessionTabNameIE();
else if(navigator.appName == "Netscape")
sessionTabNameNS();    

它在这一行出错,但有一些错误,它无法找到SessionTabName。任何帮助肯定会受到赞赏。谢谢,鲍勃。

1 个答案:

答案 0 :(得分:0)

在IE 11中,使用JSON显示导航器将是这样的:

{
   appCodeName: "Mozilla",
   appMinorVersion: "0",
   appName: "Netscape",
   appVersion: "5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; Tablet PC 2.0; rv:11.0) like Gecko",
   browserLanguage: "zh-TW",
   constructor: { },
   cookieEnabled: true,
   cpuClass: "x86",
   geolocation: { },
   language: "zh-TW",
   maxTouchPoints: 0,
   mimeTypes: { },
   msManipulationViewsEnabled: true,
   msMaxTouchPoints: 0,
   msPointerEnabled: true,
   onLine: true,
   platform: "Win32",
   plugins: { },
   pointerEnabled: true,
   product: "Gecko",
   systemLanguage: "zh-TW",
   userAgent: "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; Tablet PC 2.0; rv:11.0) like Gecko",
   userLanguage: "zh-TW",
   vendor: "",
   webdriver: false
}

因此,您需要在userAgent或appVersion中查看只有IE的任何关键字。此外,其他浏览器,如chrome,firefox,opera等,也是一样的