Search completed in 1.32 seconds.
12 results for "sendBeacon":
Navigator.sendBeacon() - Web APIs
the navigator.
sendbeacon() method asynchronously sends a small amount of data over http to a web server.
... syntax navigator.
sendbeacon(url, data); parameters url the url that will receive the data.
... return values the
sendbeacon() method returns true if the user agent successfully queued the data for transfer.
...And 5 more matches
Using the Beacon API - Web APIs
navigator.
sendbeacon() the beacon api's navigator.
sendbeacon() method sends a beacon request to the server in the global browsing context.
...the handler calls
sendbeacon() with the current url.
... window.onload = window.onunload = function analytics(event) { if (!navigator.
sendbeacon) return; var url = "https://example.com/analytics"; // create the data to send var data = "state=" + event.type + "&location=" + location.href; // send the beacon var status = navigator.
sendbeacon(url, data); // log the data and result console.log("
sendbeacon: url = ", url, "; data = ", data, "; status = ", status); }; the following example creates a submit handler and when that event is fired, the handler calls
sendbeacon().
...And 4 more matches
Synchronous and asynchronous requests - Web APIs
when fetch with keepalive isn't available, you can consider using the navigator.
sendbeacon() api, which can support these use cases while typically delivering a good ux.
...:( client.setrequestheader("content-type", "text/plain;charset=utf-8"); client.send(analyticsdata); } using the
sendbeacon() method, the data will be transmitted asynchronously to the web server when the user agent has had an opportunity to do so, without delaying the unload or affecting the performance of the next navigation.
... the following example shows a theoretical analytics code pattern that submits data to a server by using the
sendbeacon() method.
... window.addeventlistener('unload', logdata, false); function logdata() { navigator.
sendbeacon("/log", analyticsdata); } ...
Beacon API - Web APIs
global context the beacon api's navigator.
sendbeacon() method is used to send a beacon of data to the server in the global browsing context.
... worker context the beacon api's navigator.
sendbeacon() method is used to send a beacon of data to the server from the worker global scope.
PerformanceEventTiming - Web APIs
function sendtoanalytics(data) { const body = json.stringify(data); // use `navigator.
sendbeacon()` if available, falling back to `fetch()`.
... (navigator.
sendbeacon && navigator.
sendbeacon('/analytics', body)) || fetch('/analytics', {body, method: 'post', keepalive: true}); } // use a try/catch instead of feature detecting `first-input` // support, since some browsers throw when using the new `type` option.
CSP: connect-src - HTTP
the apis that are restricted are: <a> ping, fetch, xmlhttprequest, websocket, eventsource, and navigator.
sendbeacon().
...en this csp header: content-security-policy: connect-src https://example.com/ the following connections are blocked and won't load: <a ping="https://not-example.com"> <script> var xhr = new xmlhttprequest(); xhr.open('get', 'https://not-example.com/'); xhr.send(); var ws = new websocket("https://not-example.com/"); var es = new eventsource("https://not-example.com/"); navigator.
sendbeacon("https://not-example.com/", { ...
Index - Web APIs
2657 navigator.
sendbeacon() api, beacon, method, navigator, networking, reference, web performance,
sendbeacon the navigator.
sendbeacon() method can be used to asynchronously transfer a small amount of data over http to a web server.
Navigator - Web APIs
navigator.
sendbeacon() used to asynchronously transfer a small amount of data using http from the user agent to a web server.
Mixed content - Web security
<object> (data attribute) navigator.
sendbeacon (url attribute) other resource types like web fonts and workers may be considered active mixed content, as they are in chrome.