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

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

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

問(wèn)題描述

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

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)中,我沒(méi)有得到任何響應(yīng),什么也沒(méi)有.也嘗試使用 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?

推薦答案

因此,鑒于不想用褻瀆來(lái)抹黑這個(gè)網(wǎng)站,我只想說(shuō)有人在 magento 團(tuán)隊(duì)中沒(méi)有考慮過(guò),或者不知何故一些糟糕的代碼進(jìn)入了現(xiàn)場(chǎng)發(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 安裝中無(wú)法正常工作,可能是因?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)為這是繞過(guò)它的錯(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)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(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屋-程序員軟件開(kāi)發(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:無(wú)法在第二個(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)用程序中訪問(wèn)相機(jī)/網(wǎng)絡(luò)攝像頭?)
主站蜘蛛池模板: 亚洲va韩国va欧美va精品 | 我要操网站 | 一级大片免费看 | 亚洲免费视频一区 | 成人精品在线 | 欧美一级免费 | 一区二区福利 | 亚洲精品一区二区三区在线观看 | 久久综合国产 | 亚洲国产日韩在线 | 国产黄色免费看 | 四虎影院在线播放 | 五月婷婷中文字幕 | 在线日韩av | 激情久久久 | 午夜av福利 | 少妇一级淫片免费放 | 一级片在线视频 | 亚洲精品一二三区 | 欧洲精品一区二区 | 国产午夜在线 | 久久精品一区二区国产 | 天堂网亚洲 | 成人免费在线 | 欧美视频免费看 | 91在线精品李宗瑞 | 久青草影院 | 国产尤物视频 | 中文字幕在线观看第一页 | 欧美a一级 | 欧美激情视频一区二区 | 欧美一级精品 | 亚洲成人免费在线观看 | 最新国产精品 | 久草视频免费 | 国产午夜免费 | 一区二区欧美日韩 | 久在线视频| 五月婷婷六月天 | 黄色免费一级片 | 免费在线小视频 |