Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to detect uBlock Origin #26

Closed
wants to merge 1 commit into from

Conversation

robinvdv12
Copy link

@robinvdv12 robinvdv12 commented Nov 22, 2023

uBlock Origin doesn't "block" calls, but redirects them with a 307 redirect. So the request will never fail. This way, the catch block will never run, and adBlockDetected will never be true.

With my changes, the request will check if the responses is redirected. If so, set adBlockDetected to true.

Copy link

vercel bot commented Nov 22, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
adblock-detect-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 22, 2023 11:08am

@shadoath
Copy link

Would like to see this change added. Noticed that we are failing to detect because of this.

Copy link
Owner

@aruniverse aruniverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you bump the version in package.json to 1.2.0 ?

}).then(({ redirected }) => {
if (redirected) setAdBlockDetected(true);
})
.catch(() => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry nit: could you format the code here

@aruniverse
Copy link
Owner

changes copied into #29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants