re: Analytics with vanilla JS: page views VIEW POST


As an improvement, have a look at the Fetch API and Beacon API 🙂


Thanks for pointing that out.

I didn't know about Fetch and Beacon API. Though after a quick google search I noticed that they are not supported in IE. At least according to mozzila.org.

Any thoughts how to perform asynchronous requests in IE?

It would be a performance improvement indeed.


I would recommend not supporting IE anymore, unless absolutely needed. You can always fall back to XHR if fetch is not available (polyfill).

IE is still supported and developed right? What am I missing here?

I checked my personal page and yes percentage of IE users is low but still. Fall back to XHR sounds like a good option.

How would you do the fall back? With try and catch? Or would you try to detect if user is on IE? If yes how? As far as I know there's no consistent way to check browser version.

As I mentioned in the article I'm a bit light on JS since I come from data science. So any tips are welcome :)

IE 11 is still supported by Microsoft, but not for long. Adding a development focus on IE in 2019 is a waste of efforts, unless it's absolutely necessary. You can do it in a progressive way, where a site is usable on IE, but won't support all the features.

Falling back to XHR can be as simple as checking if (!window.fetch).

There used to be some specific HTML comments for detecting if browser is IE (not supported in IE 11). But feature detection is a better alternative than browser detection.

Alright didn't know that. Feature detection there is then.

Thanks again.

code of conduct - report abuse