Fixed JS error reporting
This commit is contained in:
parent
bdf540664d
commit
ee647904b4
@ -1,15 +1,15 @@
|
|||||||
(function() {
|
(function() {
|
||||||
window.onerror = function(message, url, lineNumber) {
|
window.onerror = function(message, url, lineNumber) {
|
||||||
//save error and send to server for example.
|
//save error and send to server for example.
|
||||||
var request = new XMLHttpRequest();
|
var request = new XMLHttpRequest();
|
||||||
request.open('POST', '/js_error', true);
|
var data =
|
||||||
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
|
||||||
request.send(
|
|
||||||
'message=' + encodeURI(message) +
|
'message=' + encodeURI(message) +
|
||||||
'&url=' + encodeURI(url) +
|
'&url=' + encodeURI(url) +
|
||||||
'&lineNumber=' + encodeURI(lineNumber) +
|
'&lineNumber=' + encodeURI(lineNumber) +
|
||||||
'&location=' + encodeURI(window.location.href)
|
'&location=' + encodeURI(window.location.href);
|
||||||
);
|
request.open('GET', '/js_error?' + data, true);
|
||||||
|
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
||||||
|
request.send();
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
window.forEach = function(a, f) { Array.prototype.forEach.call(a, f) };
|
window.forEach = function(a, f) { Array.prototype.forEach.call(a, f) };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user