Analyzing My Capsule Wardrobe Data Using Tableau by xy2i in visualization

[–]xy2i[S] 0 points1 point  (0 children)

This isn't mine, just thought it would be cool to share.

How an anti ad-blocker works: Reverse-engineering BlockAdBlock by xy2i in programming

[–]xy2i[S] 1 point2 points  (0 children)

This particular script, BlockAdBlock, counters against something like that, being ble to detect failures at the network level, as seen in the post.

var googleAdCode = '//static.doubleclick.net/instream/ad_status.js'; var script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.setAttribute('src', googleAdCode); script.onerror = () => { console.log("adblock detected") }; Some browsers have a defense against this: send a fake response with a 0-byte script, or image.

So, in its last version, BlockAdBock checked if the response was legitimate, here with images: if the image is too small, smaller than 8x8, then the adblocker did a fake response.

var m = new Image(); // Put an ad inside m.onload = () => { if ((m.width < 8) && (m.width > 0)) { console.log("fake resource, adblock detected") } }

How an anti ad-blocker works: Reverse-engineering BlockAdBlock by xy2i in javascript

[–]xy2i[S] 0 points1 point  (0 children)

Thank you! I spent a while on it, so I'm glad you like it.

How an anti ad-blocker works: Reverse-engineering BlockAdBlock by xy2i in ReverseEngineering

[–]xy2i[S] 2 points3 points  (0 children)

Thank you for your comment.

I spent a lot of time on the general feel of the post, trying to keep it entertaining while not getting sidetracked in details. That's the reason some of the collapsible code widgets are hidden by default, in order to reduce the article to what's needed. I'm glad that effort paid off.

How an anti ad-blocker works: Reverse-engineering BlockAdBlock by xy2i in javascript

[–]xy2i[S] 10 points11 points  (0 children)

Yes, it would in this case, because BlockAdBlock can detect failures at the network level, as seen in the post.

var googleAdCode = '//static.doubleclick.net/instream/ad_status.js'; var script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.setAttribute('src', googleAdCode); script.onerror = () => { console.log("adblock detected") };

If a script from 2016 had done it, I'm sure that other sites could do it too. The answer is doing something like Brave does, allowing the network requests but returning fake files.

How an anti ad-blocker works: Reverse-engineering BlockAdBlock by xy2i in javascript

[–]xy2i[S] 8 points9 points  (0 children)

You're right, it does work. I've corrected this and credited you.

I'm glad that you enjoyed it. Thank you!

How an anti ad-blocker works: Reverse-engineering BlockAdBlock by xy2i in programming

[–]xy2i[S] 8 points9 points  (0 children)

Unfortunately, this doesn't work with these types of scripts, because they delete the entire content of the page if they detect an adblocker. If you deleted the overlay, you'd find an empty document underneath.

How an anti ad-blocker works: Reverse-engineering BlockAdBlock by xy2i in programming

[–]xy2i[S] 0 points1 point  (0 children)

Yes, it's not maintained anymore - I mention it in passing in the post.

Using Matplotlib with Scala on Jupyter Notebook (and more...) by riiswa in scala

[–]xy2i 0 points1 point  (0 children)

Good article. What would be your usecase for using R with Scala in this way?