cat -v harmful stuff

Everyone has JavaScript, right?


Your user requests your web app
Has the page loaded yet?
“All your users are non-JS while they're downloading your JS” — Jake Archibald
Did the HTTP request for the JavaScript succeed?
If they're on a train and their net connection goes away before your JavaScript loads, then there's no JavaScript.
Did the HTTP request for the JavaScript complete?
How many times have you had a mobile browser hang forever loading a page and then load it instantly when you refresh?
Does the corporate firewall block JavaScript?
Because loads of them still do.
Does their ISP or mobile operator interfere with downloaded JavaScript?
Sky accidentally block jQuery, Comcast insert ads into your script, and if you've never experienced this before, drive to an airport and use their wifi.
Have they switched off JavaScript?
People still do.
Do they have addons or plugins installed which inject script or alter the DOM in ways you didn't anticipate?
There are thousands of browser extensions. Are you sure none interfere with your JS?
Is the CDN up?
CDNs are good at staying up (that’s what being a CDN is) but a minute downtime a month will still hit users who browse in that minute.
Does their browser support the JavaScript you’ve written?
Check Can I Use for browser usage figures.

Is all the above true?

Then yes, your JavaScript works.


Progressive enhancement. Because sometimes your JavaScript just won’t work.

Be prepared.