我创建下一个代码并在某些手机浏览器中捕获错误:
Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 NokiaN97-1/22.0.110; Profile/MIDP-2.1 Configuration/CLDC-1.1) AppleWebKit/525 (KHTML, like Gecko) BrowserNG/7.1.4
Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 Nokia5800d-1/52.0.007; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.2.6.9 3gpp-gba
Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 Nokia5228/40.1.003; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.2.7.4 3gpp-gba
Mozilla/5.0 (SymbianOS/9.3; Series60/3.2 NokiaC5-00/031.022; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.2.3.1
Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 Nokia5230/40.0.003; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.2.7.4 3gpp-gba
代码:
try {
var blank_function = function () {}; if (window) window.ll = 9423;
if (!window.console) {
window.console = {time: blank_function, timeEnd: blank_function, log: blank_function, dir: blank_function}; if (window) window.ll = 9425;
}
if (!console.time) {
console.time = blank_function; if (window) window.ll = 9428;
}
if (!console.timeEnd) {
console.timeEnd = blank_function; if (window) window.ll = 9431;
}
if (!console.log) {
console.log = blank_function; if (window) window.ll = 9434;
}
if (!console.dir) {
console.dir = blank_function; if (window) window.ll = 9437;
}
console.time("other"); if (window) window.ll = 9441;
} catch(e) {if (window.send_exception && typeof window.send_exception == typeof function(){}) {window.send_exception(e);}}
它有什么问题?我不使用返回值 => 它可能是未定义的。在其他浏览器中可以正常工作。
异常数据:
Array (
[name] => TypeError
[message] => Value undefined (result of expression console.time) is not object.
[line] => 9442
[toString] => TypeError: Value undefined (result of expression console.time) is not object.
)
PS对不起英语不好。
PPS window.ll = 行号 - 1。