今天程式發生了一個IE8 bug,因使用js來做前端的i18n,但同事有把元素的id取得跟i18n js的變數一樣,導致js錯誤發生。
HTML
<span id=”stupid_ie_8”></span>
//i18n key
stup_ie_8 = “IE好弱”;
//script
$(“#stupid_ie_8”).html(stup_ie_8);
星期三, 9月 26, 2012
星期一, 1月 02, 2012
console.log throws error on IE8
經測試可用的程式碼如下:
(function($){
$.console = function(logger){
if(typeof window["console"] != "undefined"){
console.log(logger);
}
};
})(jQuery);
缺點要改用自已寫的方式,優點是在ie8有無使用開發者工具都能正常執行網頁。
Reference:
console.log throws error on Internet Explorer IE
訂閱:
意見 (Atom)