Improve script resiliency
This commit is contained in:
parent
d1c6d4ed52
commit
2fa5db362a
@ -3,8 +3,14 @@ window.onload = function () {
|
|||||||
Math.random().toString(36).substring(2, 15) +
|
Math.random().toString(36).substring(2, 15) +
|
||||||
Math.random().toString(36).substring(2, 15);
|
Math.random().toString(36).substring(2, 15);
|
||||||
function sendUpdate() {
|
function sendUpdate() {
|
||||||
|
try {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open("POST", self.location.protocol + "//{{request.site.domain|default:request.META.HTTP_HOST}}{{endpoint}}", true);
|
xhr.open(
|
||||||
|
"POST",
|
||||||
|
self.location.protocol +
|
||||||
|
"//{{request.site.domain|default:request.META.HTTP_HOST}}{{endpoint}}",
|
||||||
|
true
|
||||||
|
);
|
||||||
xhr.setRequestHeader("Content-Type", "application/json");
|
xhr.setRequestHeader("Content-Type", "application/json");
|
||||||
xhr.send(
|
xhr.send(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
@ -15,6 +21,7 @@ window.onload = function () {
|
|||||||
window.performance.timing.navigationStart,
|
window.performance.timing.navigationStart,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
setInterval(sendUpdate, 5000);
|
setInterval(sendUpdate, 5000);
|
||||||
sendUpdate();
|
sendUpdate();
|
||||||
|
Loading…
Reference in New Issue
Block a user