Freelance web-developer. Works mostly with React. Implements accessible, responsive web applications. Loves functional programming patterns. Does not love TypeScript.
Hi, thanks for the article. I am considering sendBeacon for tracking in my current project. One question: everywhere it reads "small amount of data". What does that mean? Is there a limit? A best practice?
Regards
For example, with research, I had found that someone tested the limit on an older version of chrome on windows and found the limit to be, (2^16).
Please take a look.
varurl='http://jsfiddle.net?sendbeacon';varn=65536;// sendBeacon limit for Chrome v40 on Windows (2^16)// this method courtesy of http://stackoverflow.com/questions/14343844/create-a-string-of-variable-length-filled-with-a-repeated-charactervardata=newArray(n+1).join('X');// generate string of length nif(!navigator.sendBeacon(url,data)){alert('data limit reached');}
Freelance web-developer. Works mostly with React. Implements accessible, responsive web applications. Loves functional programming patterns. Does not love TypeScript.
Hi, thanks for the article. I am considering sendBeacon for tracking in my current project. One question: everywhere it reads "small amount of data". What does that mean? Is there a limit? A best practice?
Regards
Hi Tobias,
This is a great question. Yes, there is a limit and it is up to the user-agents(browser vendors) to decide what would be the limit.
The spec says,
Check out this link for more details: w3.org/TR/beacon/#sec-sendBeacon-m...
For example, with research, I had found that someone tested the limit on an older version of chrome on windows and found the limit to be,
(2^16)
.Please take a look.
Oh great, thank you very much. I hoped that there was a spec'd limit but this way I can check the relevant browsers.
Welcome, Tobias!
I have also added a small section about it in the article now.