經測試可用的程式碼如下:
(function($){
$.console = function(logger){
if(typeof window["console"] != "undefined"){
console.log(logger);
}
};
})(jQuery);
缺點要改用自已寫的方式,優點是在ie8有無使用開發者工具都能正常執行網頁。
Reference:
console.log throws error on Internet Explorer IE
沒有留言:
張貼留言
留個話吧:)