Certain resource files are blocked by adblockers leaving the page non-interactive #8307
Replies: 7 comments
-
This is caused by adblockers, e.g. uBlock Origin. To workaround this, we should move lines 15 to 30 in load-directly-or-404.js into their own function, and export this separately (in addition to calling it from the same place in the default export), then call this function at line 102 of ensure-resources.js. I'll be happy to review a PR which fixes this, or if it's not done by next week then I'll start work on it myself! |
Beta Was this translation helpful? Give feedback.
-
Having said that, a workaround like the one described above could mean that the page isn't interactive or some parts fail to load - not entirely sure of the consequences. |
Beta Was this translation helpful? Give feedback.
-
Interesting, maybe you could make gatsbys 404 page optional while your digging through those files which might fix #5129 I still don't understand gatsbys internals too good myself… |
Beta Was this translation helpful? Give feedback.
-
#8510 should fix the flickering issue, but the page will still be non-interactive when using an adblocker and show the following message in the console:
...which was added as a check to prevent this kind of infinite loop which should be impossible. So the problem is that we need to prevent adblockers from blocking "https://www.gatsbyjs.org/static/d/41/path---packages-gatsby-plugin-google-analytics-aac-98e-qnUF1p28LlafU5nMmRyf44Hgk.json". Since the page is rendered server-side, we can afford to keep ignoring this error - the only reasonable way we could fix would be to rename the file to something else which isn't blocked by most adblockers. Unfortunately this means we don't have any interactivity, but we can't really do anything about that (apart from maybe links if we use the link-catcher plugin). |
Beta Was this translation helpful? Give feedback.
-
Old issues will be closed after 30 days of inactivity. This issue has been quiet for 20 days and is being marked as stale. Reply here or add the label "not stale" to keep this issue open! |
Beta Was this translation helpful? Give feedback.
-
Thinking we could maintain the same list of keywords and just remove them from file names and replace them with gibberish? Or hashes I guess of the "bad" words? |
Beta Was this translation helpful? Give feedback.
-
We can control hashes for query results pretty easily using above method, not sure about hashes for js bundles/chunks produced by webpack? |
Beta Was this translation helpful? Give feedback.
-
https://www.gatsbyjs.org/packages/gatsby-plugin-google-analytics/
Tried it in regular and incognito windows.
/cc @davidbailey00
Beta Was this translation helpful? Give feedback.
All reactions