Feature Request: Have JS gracefully fail, if blocked, rather than fatally
-
I was wondering why certain JavaScript elements weren’t working on a site, and I found that it was trying to call
catapultReadCookie
which was said to be undefined.It turns out this was undefined due to an annoyance blocking extension on the visitor’s browser (these aren’t exactly uncommon as one might imagine) which was causing whatever
catapultReadCookie
is defined in to not be loaded on the page. I confirmed that this was the case by whitelisting the site from content blockers to find it worked properly.– Solution –
Really, it appears the solution would be to have the JavaScript that’s on the page that usescatapultReadCookie
check to see iftypeof catapultReadCookie != 'undefined'
or something to that effect before being called (simply doing nothing if it hasn’t been defined.)The user’s browser is blocking that from being shown anyway so it might as well not break other parts of the site for them as a result (gracefully fail rather than causing a fatal JS error on the page.)
- The topic ‘Feature Request: Have JS gracefully fail, if blocked, rather than fatally’ is closed to new replies.