Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
20852 มุมมอง

When I try to use console.log in a web addon javascript file, Firefox developer console gives the warning:

The Web Console logging API (console.log, console.info, console.warn, console.error) has been disabled by a script on this page.

Where is it disabled, and how can I enable it?

On Chromium it is working.

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

According to this stackoverflow answer:

This happens when the page itself defines a global variable called console, for example. If the page is browser-sniffing to decide whether to define it, the behavior could differ in different browsers.

Which is what happens in corestup.js, lines [4,13]:

var console;
if (!console) {
    // Even IE9 only exposes console object if debug window opened
    console = {};
    ('log error debug info warn assert clear dir dirxml trace group'
        + ' groupCollapsed groupEnd time timeEnd profile profileEnd count'
        + ' exception').split(/\s+/).forEach(function(property) {
            console[property] = _.identity;
    });
}

I've submitted this as an issue: https://github.com/odoo/odoo/issues/903

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 16
4788
0
มี.ค. 15
3963
4
มี.ค. 15
6500
0
เม.ย. 25
558
2
ต.ค. 19
9240