Detects browsers that use AdBlock and displays a warning on the screen.
- install package via bower:
$ bower install angularjs-adblock
- include the supplied JS and CSS file.
<link rel='stylesheet' href='dist/detect-adblock.css' type='text/css'/>
<script type='text/javascript' src='dist/detect-adblock.js'></script>
- Include the loading bar as a dependency for your app.
angular.module('myApp', ['detectAdblock'])
- Start detect
angular.module('myApp', ['detectAdblock'])
.run(function (adblock) {
adblock.detect();
});
- Activate adblock and see alert.
Customize the template:
angular.module('myApp', ['detectAdblock'])
.config(['adblockProvider', function(adblockProvider) {
adblockProvider.imagePath = 'your_alert_image';
adblockProvider.title = 'your_alert_title';
adblockProvider.description = 'your_alert_description';
adblockProvider.cancel = true; // Cancel button in alert
adblockProvider.refresh = true; // I have Dısable Adblock button in alert
}]);
Licensed under the MIT license