【问题标题】:Uncaught TypeError: Cannot read property 'focus' of undefined on chrome未捕获的类型错误:无法读取 chrome 上未定义的属性“焦点”
【发布时间】:2017-11-02 03:32:11
【问题描述】:
 var newWindow=window.open('','export');

                // Puts focus on the newWindow
                if (window.focus) {
                    newWindow.focus();
                }

我想打印我的网页,然后它在 Mozilla 中可以正常工作,但在 google chrome 中却不行

【问题讨论】:

    标签: javascript jquery angularjs google-chrome


    【解决方案1】:

    您正在检查window.focus,但随后尝试使用 newWindow.focus。对检查和使用的内容保持一致。

    【讨论】:

    • var newWindow=window.open('','export'); if (newWindow.focus) { newWindow.focus();如果 (newWindow.focus) {
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-22
    • 2015-01-06
    • 2017-07-26
    • 2021-06-07
    • 2019-02-26
    相关资源
    最近更新 更多