JavaScript Error when visitor has AdBlocker enabled (proposed fix)
-
I had this issue when visitors are coming to the site with an AdBlock plugin/extension enabled on their browser. This is something visitors will be doing(!), which calls for a fix to be added to the plugin to account for this as it breaks JavaScript from running on the site after that point.
The ad blocker effectively prevents the jquery.cookie.js file from being loaded (since it’s in the adrotate folder & triggers it to be blocked based on that name), and that then causes the jQuery.cookie(); code to generate a JavaScript error.
I’ve gone ahead & proposed a quick & simple fix here: https://gist.github.com/KZeni/d58e10c4e8aa11e5a3c4 (changes can be seen here: https://gist.github.com/KZeni/d58e10c4e8aa11e5a3c4/revisions)
It simply checks to make sure the “cookie” jQuery plugin has been loaded. If it has, it will work as intended. If they’re using an AdBlocker, the site will still operate and we do the best we can with the fact that they’re blocking that folder & the assets found within.
I’d love to see this fix added to the plugin so I don’t have to reapply it for my visitors to have a fully functional site. As such, I’ve posted this in the developer’s support forum as well in hopes it gets patched into the next version: https://www.adrotateplugin.com/support/forums/topic/jquery-error-with-update-no-ads-showing-at-all/#post-18248
The topic ‘JavaScript Error when visitor has AdBlocker enabled (proposed fix)’ is closed to new replies.