scripts
scripts copied to clipboard
sendOnLeave throws a TypeError
sendOnLeave throws a TypeError: Illegal invocation on line 554:
nav.sendBeacon(fullApiUrl + "/append", stringify(append));
This is the relevant part of the code:
if (push || !nav.sendBeacon) {
// sendData will assign payload to request
sendData(append, undefinedVar, trueVar);
} else {
nav.sendBeacon(fullApiUrl + "/append", stringify(append));
}
The error happens when nav.sendBeacon
is invoked in the else
block.
You might want to check if nav
or sendBeacon
is being called out of context or if there’s an issue with the scope.