Skip to content

potatojam/defold-adblock-detector

Repository files navigation

Adblock Detector for Defold

Finds adblock using this package and this

⚠️ neutral.js and pp34.js files are added to the project to detect AdGuard, uBlock Origin, Adblock Plus.

⚠️ Adblock blocks requests when it is enabled in the browser and errors may occur in the console.

⚠️ When you run a Build HTML there may be bugs in the current Defold version. This is because the editor does not understand URL parameters. This does not affect to the Bundle.

Installation

You can use it in your own project by adding this project as a Defold library dependency. Open your game.project file and in the dependencies field add a link to the ZIP file of a specific release.

API

adblockdetector.detect(callback)

Detect if a browser is using Adblock

Parameters

  • callback function required function(self, result)

Example

local function on_complete(self, result)
    if result then
        print("Adblock detected")
    else
        print("Adblock not detected")
    end
end

function init(self)
    if adblockdetector then
        adblockdetector.detect(on_complete)
    end
end

Credits

Made by PotatoJam.

Based on just-detect-adblock

And on Detecting uBlock Origin and Adblock Plus with JavaScript only

License

MIT license