久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Magento 中的 JavaScript 控制臺(tái)登錄

JavaScript console log in Magento(Magento 中的 JavaScript 控制臺(tái)登錄)
本文介紹了Magento 中的 JavaScript 控制臺(tái)登錄的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我在 Magento 中有一個(gè)自定義的 phtml 頁面.據(jù)我所知 Magento 使用 jQuery 和原型庫.

I have a custom phtml pages in Magento. As far I know Magento uses jQuery and prototype libraries.

例如,如果我需要外部的jQuery/jQueryUI,我需要使用.noConflict()

For example, if I need external jQuery/jQueryUI, I need to use .noConflict()

但是如果我想使用

console.log('Hello world');

在 Chrome 15 控制臺(tái)中,我沒有得到任何響應(yīng),什么也沒有.也嘗試使用 Firebug.

In Chrome 15 console I got no response, nothing. Also tried with Firebug.

顯然與 Magento JavaScript 代碼存在一些沖突.有什么解決辦法嗎?

Obviously there is some conflict with Magento JavaScript code. Is there any solution?

推薦答案

因此,鑒于不想用褻瀆來抹黑這個(gè)網(wǎng)站,我只想說有人在 magento 團(tuán)隊(duì)中沒有考慮過,或者不知何故一些糟糕的代碼進(jìn)入了現(xiàn)場發(fā)布....

So in light of not wanting to smear this site with profanity I will just say someone wasn't thinking in the magento team or somehow some crappy code got into live releases....

如果您的 console.log() 在 Magento 安裝中無法正常工作,可能是因?yàn)橐韵略?

If your console.log() is not working on a Magento installation it is likely because of the following:

magento/js/varien/js.js @ line ~636,Magento 版本.1.6.2.0

In magento/js/varien/js.js @ line ~636, Magento ver. 1.6.2.0

if (!("console" in window) || !("firebug" in console))
{
    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
    "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];

    window.console = {};
    for (var i = 0; i < names.length; ++i)
        window.console[names[i]] = function() {}
}

這有效地防止了 console.log() 在帶有 firebug 的 firefox 以外的任何瀏覽器中工作.

This effectively prevents console.log() from working in any browser other than firefox with firebug.

當(dāng)然,為了保護(hù) IE,但我認(rèn)為這是繞過它的錯(cuò)誤方法,相反,人們應(yīng)該意識(shí)到他們對(duì)日志記錄做了什么,并在他們不這樣做時(shí)面對(duì)后果.

To protect IE, surely, but I think this is the wrong way to get arround it, instead people should be aware of what they do with their logging and face the consequences when they don't.

要修復(fù)它,請(qǐng)確保在嘗試執(zhí)行 console.log() 之前放置 delete window['console']; (javascript),或者如果你不介意修改核心文件,刪除上面的代碼.

To fix it just make sure you put delete window['console']; (javascript) before you try to do a console.log(), or if you don't mind modifying the core files, delete the code above.

請(qǐng)注意:刪除控制臺(tái)修復(fù)以進(jìn)行生產(chǎn),刪除在 IE6-8 中不起作用并引發(fā)錯(cuò)誤

這篇關(guān)于Magento 中的 JavaScript 控制臺(tái)登錄的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to fix BrowserWindow is not a constructor error when creating child window in Electron renderer process(在 Electron 渲染器進(jìn)程中創(chuàng)建子窗口時(shí)如何修復(fù) BrowserWindow 不是構(gòu)造函數(shù)錯(cuò)誤) - IT屋-程序員軟件開發(fā)技術(shù)
mainWindow.loadURL(quot;https://localhost:3000/quot;) show white screen on Electron app(mainWindow.loadURL(https://localhost:3000/) 在 Electron 應(yīng)用程序上顯示白屏)
Electron webContents executeJavaScript : Cannot execute script on second on loadURL(Electron webContents executeJavaScript:無法在第二個(gè) loadURL 上執(zhí)行腳本)
how to use electron browser window inside components in angular-cli?(如何在angular-cli的組件內(nèi)使用電子瀏覽器窗口?)
ElectronJS - sharing redux store between windows?(ElectronJS - 在 Windows 之間共享 redux 存儲(chǔ)?)
How to access camera/webcamera inside electron app?(如何在電子應(yīng)用程序中訪問相機(jī)/網(wǎng)絡(luò)攝像頭?)
主站蜘蛛池模板: 久久机热 | 成人精品啪啪欧美成 | 久久亚洲美女 | 国产精品久久久久久久久久免费 | 免费观看黄色片视频 | 天堂精品 | 99久久婷婷国产综合精品电影 | h视频在线免费 | 免费在线观看一区二区 | 青草久久免费视频 | 九九热这里只有精品在线观看 | 欧美福利专区 | 一区| 国产精品视频免费观看 | 一级毛片视频 | 亚洲综合色视频在线观看 | 人人九九精 | 亚洲一区二区免费 | 欧美一区二区三区视频在线播放 | 色综合视频在线 | 国产精品www | 欧美激情久久久 | 成年免费在线观看 | 日本黄色高清视频 | 国产精品久久久久久久午夜片 | 91九色porny首页最多播放 | 看特级黄色片 | 亚洲欧洲精品一区 | 国产精品自拍视频网站 | 中文字幕成人av | 日韩欧美视频在线 | 中文字幕第一页在线 | 超碰97干| 成人一区二 | 91久久精品一区 | 国产高清在线精品 | av手机在线 | 黄色在线观看网址 | 草在线| 国产精品一级在线观看 | 欧美成人精品一区二区男人看 |