Internet Explorer 8 JS错误:'window.toolbar.visible'为null或不是对象 [英] Internet Explorer 8 JS Error: 'window.toolbar.visible' is null or not an object

查看:134
本文介绍了Internet Explorer 8 JS错误:'window.toolbar.visible'为null或不是对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码用于检查我们网站中的页面何时被加载到没有工具栏或菜单栏的窗口中(还有其他一些检查,例如移动设备和用户代理,但我不会在这里详细说明):

I have the following code for checking when a page within our website is being loaded in a window without toolbars or menubars (there are several other checks, like mobile devices and user agents, but I won't elaborate them here):

if (window.toolbar.visible !== true || window.menubar.visible !== true) {  
    // do some stuff  
}

除Internet Explorer 8外,它在任何地方都能正常工作返回以下错误:
'window.toolbar.visible'为null或不是对象

(也发生在 window.menubar.visible

It works fine everywhere except for Internet Explorer 8 which returns the following error: 'window.toolbar.visible' is null or not an object
(also happens with window.menubar.visible)

我无法找到IE8的替代品。对此有何帮助?

奖金问题:是否有像Jref=\"https://developer.mozilla.org/en/JavaScript/Reference\" rel=\"nofollow\"> Mozilla的一个不错的Javascript引用,但对于Internet Explorer?

I cannot find anywhere an alternative for IE8. Any help on this?
Bonus question: Is there a decent Javascript reference like Mozilla's, but for Internet Explorer?

感谢您阅读并思考此问题。

Thanks for reading and thinking about this problem.

推荐答案

IE没有 window.toolbar window.menubar 我也不知道在 MSDN的<页面上查看它们的替代方案code> window 对象

IE doesn't have window.toolbar or window.menubar nor do I see any alternatives for them on MSDN's page for the window object.

您可以通过在测试之前测试对象来检查不会引发错误对于其财产,例如:

You can make your check not throw an error by testing for the object before testing for its property, e.g.:

if ((window.toolbar && window.toolbar.visible)
    || (window.menubar && window.menubar.visible)) {  
    // do some stuff  
}




奖金问题:是否有一个不错的Java像Mozilla的脚本引用,但对于Internet Explorer?

Bonus question: Is there a decent Javascript reference like Mozilla's, but for Internet Explorer?

我认为MSDN是你要做的最好的。如果您正在寻找有关IE特定品牌的JavaScript和DOM对象的信息来源,那么没有更好的来源。导航很痛苦,但是......

I think MSDN is the best you're going to do. If you're looking for the source of information on IE's particular brand of JavaScript and DOM objects, there's no better source. It's a pain to navigate, but...

这篇关于Internet Explorer 8 JS错误:'window.toolbar.visible'为null或不是对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆