Today we will learn how to recognize the fact that the person has AdBlock or AdGuard enabled and, accordingly, prohibit him from viewing the website or some other action, such as downloading a file. It's no secret that today almost everyone has Internet advertising filters installed in their browsers. In some browsers, such as Yandex, AdBlock is already included. Such extensions block ads on YouTube or on your websites, so advertising revenue is no longer coming ...

You need to decide what you will do if a person has AdBlock enabled.

Let's try to display a huge overlay on the whole page, which will say “ Please turn off the AdBlock ad blocker". Thus, access to the website will be completely closed.

Create a DIV with an ID like # spoof-overlay. Never create DIVs with classes or identifiers in which the word ad or advertising is present because AdGuard will even block this block. Inside our DIV we will write: please turn off AdBlock or AdGuard to access the site.


Please turn off AdBlock or AdGuard to access the site

Some valuable content ...

Now let's add some styling to our DIV.

# spoof-overlay (display: none; background-color: rgba (0,0,0,0.9); position: fixed; left: 0; top: 0; width: 100%; height: 100%; color: white; text-align: center; font-size: 30px; font-weight: bold; padding-top: 17%; z-index: 99999;)

According to the standard, we will write display: none; and we will change this property in JavaScript, if suddenly the visitor has an AdBlock. It is very easy to check this.

To do this, we will create two JS files. The first one will be called custom.js... Second advert.js... Give your files exactly the same names. Advert this is the name of a popular ad network. Adblock blocks all their advertising banners and teasers, so it will take the advert.js script for the original one. Adblock will think that this is an advertisement and will not execute it. And we will check the fact of execution of this JavaScript file and its loading. If he loaded, then everything is fine, but if not, then we will display information that this is an advertisement.

Let's create a simple function in file advert.js and let's call it spoof:

Function spoof () (window.spoof_jdsfoodsfnsofnkwjspnf = true;) spoof ();

Checking for the presence of a property spoof_jdsfoodsfnsofnkwjspnf in the facility window... If the property is present, then this will indicate that Adblok is not. Opening the file custom.js and add the following code:

JQuery (document) .ready (function () (if (typeof window.spoof_jdsfoodsfnsofnkwjspnf == "undefined") (// AdBlock or AdGuard is active! // Do whatever we want // For example, show our jQuery message window ("# spoof-overlay"). fadeIn ("slow");)));

Download the finished script (4 KB)

Watch the video version of the lesson from Howdy Ho

9 july 2018

AdBlock is a major problem in the online advertising industry today. The number of users blocking advertising content is gradually increasing, while the profits of site owners are decreasing. Numerous subscriptions allow owners of extensions to significantly increase the list of unwanted elements by adding not only ads to it, but also, for example, social widgets or scripts for collecting statistics installed on the page, which seriously increases the privacy of browsing and complicates the involvement of visitors in the process of integrating the site with social networks. Sooner or later, developers are faced with the question: how to check for the presence of AdBlock and minimize the "damage" it causes?

How ad blockers work

From a technical point of view, AdBlock, uBlock Origin, AdGuard and other similar browser extensions (hereinafter referred to as AdBlock) do not block ads themselves, but the corresponding network requests: when the page loads, each connection is checked against the list of prohibited ones and, if necessary, is rejected. In the blockers themselves, this is called surge protector... It can contain both a specific list of domains, for example, ad.mail.ru, and parts of the URL - / ucoz / img / uads /, which allows you to block requests even if the mask matches.

It happens that, as a result of filtering, the site loses its normal performance or the capabilities of the network filter alone are not enough to block unwanted content. To do this, hiding elements is provided in blockers - cosmetic filter which is applied by embedding high priority CSS rules in the document that hide ad areas, usually by using the display property or in some situations by adding the hidden attribute.

The work of the uBlock Origin cosmetic filter on the example of VKontakte advertising: the #ads_left element is forcibly hidden by inline CSS with an impressive size selector.

For blocked or hidden content, an exception to the rule is available: if the user wishes, the extension can ignore unobtrusive (acceptable) advertising- banners, ads and links that are complementary to the main content, do not focus too much on themselves and in some cases are useful. Unfortunately, it is virtually impossible for ordinary sites to get into the whitelist, which means that ad blocking is guaranteed by default.

But advertising is not the only filtering object. Blocking external resources or hiding items depends on subscriptions that are included in the custom AdBlock. Each subscription focuses on a specific type of inappropriate content and is updated periodically.

Popular subscriptions

Unwanted content, on the basis of which filter lists for ad blockers are compiled, can be roughly divided into groups. The list is not exhaustive, but covers the main objects of filtration.

  1. Advertising - any elements of the page, including resources connected from the outside, in the identifiers, classes and attributes of which there are expressions prohibited by the filter. Usually, the subscription is compiled with a regional account, for example, EasyList + RuAdList.
  2. Elements of social services - buttons "share", widgets of social networks and other elements embedded through the API. The main list is.
  3. "Annoying" elements - auxiliary content of the page: buttons for subscriptions, RSS, scrolling up; newsletter forms; blocks with warnings, information about the privacy policy and the use of cookies, etc. All this is contained in the Fanboy's Annoyance List.
  4. Statistics services - traffic counters and scripts that track user behavior are actually not advertisements, but are recommended for blocking in order to increase privacy. Among such lists, it is worth highlighting EasyPrivacy and regional RuAdList Counters.
  5. Elements "Anti-AdBlock" - banners, modal windows and pop-up notifications that are displayed to users with enabled extensions and urge to disable the blocker and / or restrict the functionality of the site. The answer to them are lists of the Anti-AdBlock Filter type.
  6. Malicious and fraudulent content - sites that harm the computer and the user are blocked by all means: search engines, antiviruses, browsers. Anti-ad extensions also offer similar filters, such as Malware Domains.
  7. Custom blocking rules - the user can independently block a specific network request or hide an element on the page, which will be recorded in a separate filter.

Thus, the list of "candidates" for potential hiding or blocking significantly increases, and the question arises of how a developer can take this problem into account when coding a site.

Layout taking into account AdBlock

Periodically renewed subscriptions with a huge number of blocking rules cannot be thoroughly analyzed, and based on them, it is impossible to compose universal recipes for the correct layout of content that may fall under the influence of filters. The most correct solution would be to install all kinds of subscriptions and check a specific site through the blocker's logs. Below are general layout guidelines for the two most common types of content - ads and social widgets.

Advertising blocks

Due to the fact that the cosmetic filter, similarly to the network filter, also works on a mask and checks the names of identifiers, classes and attributes of elements with those specified in the list, regardless of the domain, such elements as, for example, #adv, .ad-google, .banner125x125, .sponsor can be filtered -logo, a and many others, therefore, in order to avoid layout distortions, such names are not recommended for designating elements in HTML markup and for specifying the content of href, src attributes in links, images and frames: they will be hidden by default, even if the developer does not meant by them advertising content.

To minimize the effects of cosmetic filters, care should be taken to ensure that content that could potentially be hidden parent container with its equivalent width and height, which is especially useful for relatively large ad units:

Ads ...

Using this simple technique, when an element falls under a filter, an empty space appears in its place, which can be used, for example, to display a placeholder or from blocking rules.

It is important that AdBlock also parses the attributes of elements, therefore, links whose href contains an explicit indication of advertising are recommended to be replaced via URL shortening services, and the contents of the src attribute of images should be converted to base64 if possible:

Social widgets

Almost all popular "social scripts" are blocked by both cosmetic and network filters: the mentioned subscription Fanboy's Social Blocking List contains a significant number of class names and identifiers that are often used when coding blocks that include social widgets: .b-share, .article__footer-share-title, .connect-icons and many others, as well as masks for external scripts, for example, / fbshare .js, /share42.js, /twitter.js.


AdBlock is the reason for hiding not only ads, but also blocks with social buttons. The default cosmetic filter adds display: none to an element with class .article__share.

To limit the actions of filters to such elements, developers should, if possible, abandon popular solutions in favor of their own scripts (example of creating it yourself) and more selectively use names to denote content in markup. The same applies to images used, as a rule, as social icons:

Obviously, it is not always possible to "save" content from blocking, and the best thing to do in such a situation is to ask the user to exclude the site from the AdBlock filters. It is not necessary to use JS to display a call: it is enough to apply simple CSS techniques, which will be discussed below. But first, it is worth considering the issue of the content and place of appearance of the appeal on the page, since its main goal is not only to attract the attention of the visitor, but also to obtain consent.

How to correctly ask the user to disable AdBlock?

To post notifications and requests (or links to them) to include the site in an exclusion from filtering, it is recommended restrict yourself to the space where the advertisement was supposed to appear, since being guided by the principle “turn off AdBlock or leave” and forcibly depriving you of the opportunity to use the site normally means losing the loyalty of your visitors.

When disabling AdBlock is a categorical prerequisite, it demotivates and forces the visitor to look for other sites or, if it happens that he has no other options, spend time bypassing such blocking by manually hiding intrusive elements from the page.


An example of the correct display of a request to disable AdBlock on Habré. The link to the appeal is unobtrusive and is placed strictly in the place of the advertising banner.

The correct address (or reference to it) should be unobtrusive, that is, not focus too much attention on itself, but at the same time - be noticeable to the user. It is desirable to provide convincing arguments in the text: for example, indicate the dependence of advertising revenue and the cost of maintaining the site. Finally, the site itself must be useful and important to the user. Exactly quality content and the ability to give the visitor what he is looking for are the main factors of audience loyalty. Therefore, in addressing the user, it is advisable to emphasize what exactly the site gives him in exchange for loyalty and what costs or efforts of the developers are associated with the high-quality provision of this information, goods, services.

This can be illustrated by the example of a request from the mentioned IT community, even a small fragment of which reflects a respectful attitude towards the participants:

As opposed to being discreet and discreet in a specific part of the site, developers often use large, fixed-positioning modals that shade the entire viewport. It is not recommended to resort to this for at least two reasons:

  • 1. A more or less experienced user, if desired, can easily hide with a cosmetic filter almost any element of the site that interferes with him, including such a modal window.
  • 2. This technique is harmful from the SEO point of view, as it can be viewed by search robots as cloaking - an attempt to hide content.

In conclusion, the question of the correct formulation of the request, it should be emphasized that advertising itself should not be abused - AdBlock was originally meant as a response to annoying content. Huge flashing banners on the half of the page, located in the center of the screen, will scare off even the most loyal users who decide to exclude the site from the filters.

Conclusion of a request to disable AdBlock on CSS

There are at least two simple options for implementing the output messages asking you to disable AdBlock in pure CSS without JavaScript: through the: empty pseudo-class and overlaying two elements on top of each other through the position and z-index properties. The first option is more likely for a surge protector, the second is more versatile, since it potentially takes into account the effect of a cosmetic filter as well.

Adding a pseudo element to the parent container

If the script that generates ad content and inserts it into the given empty block will not load due to line filter, then this container will remain without children and the pseudo-class: empty will continue to operate for it. In a trivial way, this can be demonstrated as follows:

Ads ...
.container: empty :: before (content: "Please disable AdBlock!";)

In the example, the external JS file inserts a new element into the block with the data-insert attribute. If the script does not load due to a network filter, the: empty pseudo-class styles will be applied to the .container element:

However, this method does not take into account the situation when the ad script has loaded, generated and inserted the necessary elements into the desired container, but later they were hidden by the cosmetic filter.

Overlaying one block on top of another

If the ad unit is not showing because of the cosmetic filter, i.e. an element with an advertisement inside is forcibly hidden by display: none! important, then the: empty pseudo-class will become useless:

Ads ...
Ads ...

To solve the problem, it is proposed to create additional element that directly contains a message asking you to disable the ad blocker, but place it on a layer below, that is, position it under the ad unit so that it is visible only when the display: none rule has been applied to the visually overlapping ad unit. To do this, you need to carry out simple manipulations with the position and z-index properties:

Ads ...
Please disable AdBlock.
.container (position: relative;) .adspace, .request (position: absolute; width: 100%; height: 100%;) .adspace (z-index: 2; / * ad unit is positioned one layer "above" * / ) .request (z-index: 1;)

Unlike the previous case, when it was necessary to operate only with styles for the :: before and :: after pseudo-elements, this approach expands the possibilities of styling and editing a notification that is already a full-fledged DOM element, which means, by analogy with how it is implemented in Habré , in addition to plain text, you can add a button or a link to a full appeal to the user in the block:

JSFiddle is not available without JavaScript

The only drawback of this technique is that an absolutely positioned .request element will be limited to the area of ​​its parent, so this code is inappropriate if there is a need to display a modal in the center of the screen and shade that occupies the entire viewport. You can't do without JavaScript to solve this kind of problem.

How to check for AdBlock via JS?

The mechanisms of the network and cosmetic filters open up the opportunity for developers to determine the presence of AdBlock extensions using JavaScript: the loading state of the script connected to the page is tracked by the onload and onerror events or the ability to correctly call the methods and functions contained in it, and the visibility of the element is through the analysis of the CSS properties applied to it display. Based on this, there are several ways AdBlock detection.

Using an external script

The first option is to connect to the page an external script with a name suitable for the filtering mask and the content, the execution of which will need to be checked. For example, a file named ads.js might contain just one variable:

// ads.js var adb = "";

Accordingly, when the ad blocker is enabled, the ads.js file will not be loaded, and the adb variable declared inside it will not exist. Checking the script execution is a trivial condition that must be placed below the included file:

If (typeof adb === "undefined") (// AdBlock enabled) else (// AdBlock disabled)

The second option is similar to the first: the external ads.js script can be empty (but not return a 404 error), and the check for blocking is to add onerror or onload events to it, which will be processed by a separate function with one parameter, for example, adsLoaded (status ):

Var adsLoaded = function (status) (if (status === false) (// AdBlock is on) else (// AdBlock is off))

In the HTML document, the plug-in script must have the appropriate handlers:

The disadvantage of these methods is the creation of a separate file and an additional request to the server.

Checking the visibility of an element

This approach does not imply the creation of external scripts or tracking the state of their loading: the check is carried out on a specific element by analyzing the CSS display property applied to it. Given the delay in the initialization of the ad blocker cosmetic filter, it makes sense to use the getComputedStyle () method to check the final computed value and wait until the page and external resources are fully loaded:

Window.addEventListener ("load", function () (if (window.getComputedStyle (document.getElementById ("my-adv")). GetPropertyValue ("display") === "none") (// AdBlock enabled) else (// AdBlock is disabled));

This is the most optimal way to check the blocking of not only ads, but also any other content.

Functions of advertising scripts

Advertising scripts have their own methods and functions that cannot be called when an external file is not available. For example, Google adsense creates a google_jobrunner object and embeds ads across elements with class .adsbygoogle:

Document.addEventListener ("load", function () (if (typeof window.google_jobrunner === "undefined" || document.querySelector ("ins.adsbygoogle"). InnerHTML.replace (/ s / g, ""). length === 0) (// AdBlock enabled, Adsense script blocked)));

Checking for AdBlock with the definition of subscriptions

After analyzing which elements are filtered by the blocker, you can make a guess on the availability of the corresponding types of subscriptions for the user. The decrease in the accuracy of the definition is influenced by two factors - a custom filter list and a large number of "official" subscriptions, the blocking rules of which often overlap.

The essence of the check is to create on the page invisible to the user, but visible to the AdBlock "fake" elements with identifiers, classes and attributes indicating belonging to a certain group of content. Items that fall under the influence of the cosmetic filter will testify in favor of the presence of the corresponding type of subscription, i.e., in general, indicate what kind of content the user is blocking:

In order not to litter the DOM with unnecessary garbage, elements should be removed immediately after validation.

JSFiddle is not available without JavaScript

As you can see from the example, the adbCheck () function returns an object, so if necessary, you can only refer to the property of interest:

Var result = adbCheck (); result.ads_block; // advertising result.cnt_block; // counters result.soc_block; // social widgets result.ang_block; // annoying elements result.ant_block; // anti-adblock elements result.scm_block; // fraudulent sites

Finally

Accounting for the actions of AdBlock filters is an indicator of a high-quality layout of the site and taking into account the segment of visitors who not only do not see ads, but, quite possibly, cannot use share social widgets and are not counted by visit counters and other statistics services. It is this wide range of filtering objects - from advertising scripts to social buttons and tracking elements - that popular subscriptions provide today. Checking for AdBlock is worth paying particular attention to on sites that rely on ad revenue or heavily use social widgets. In turn, a correct, tactful and unobtrusive appeal to a visitor can seriously contribute to a revision of his attitude towards blocked content.

Pop-up messages with audio accompaniment, animated ads and changing feeds on websites are annoying. Therefore, browser developers are taking measures to block unnecessary information, and users. But sometimes it is impossible to work with the site if a plug-in that prohibits displaying ads is installed in the web browser. For example, resources for watching and downloading movies and audio. Let's find out what you need to do to disable the ad blocker in popular types of browsers.

Instructions for Yandex.Browser

The web browser provides built-in blocking functionality and custom add-ons. To disable the prohibition of the browser itself, you need to go to the "Control" menu. It is called by a button on the toolbar at the top right - the icon of three horizontal stripes. From here you need to go to the "Settings" menu, then click the "Show additional ..." button. Here, uncheck the box next to the item in the "Block shocking ads" list.

If, when debugging the browser, the user made additional changes, namely, installed special plugins, then they also need to be disabled. They do it like this:

  • Go to the "Management" menu;
  • Select "Additional";
  • In a new window, in front of all ad blockers, drag the slider to the "Off" side;
  • Save changes.
To confirm actions, Yandex. It is better to restart the browser. Some applications may not take effect after normal saving of changes.

Instructions for Google Chrome users

Google also suggests using its own and custom blocking functionality. Only in this web browser, Built-in Security is effective on a per-site basis. Disabling it is easy. You need to open the site in the browser tab where you want to disable ad protection. Then on the left in the address bar, find the lock icon or the English letter "i" in the circle. Click on them and go to "Site Settings". Here, in the list of commands, select "Advertising" and in the menu on the right, select the "Allow" mode.


If the user has installed the protection plugin, then to disable the blocker in the Google browser, do the following:
  • Go to "Settings and Management" (the ellipsis icon at the top right of the window);
  • Select "Additional tools";
  • Click on "Extensions";
  • Drag the slider to the Off position or remove ad blocking extensions.



After making changes in Google Chrome, the browser must be reloaded. Especially if the edits were made to the built-in functionality.

Disable Adblock in Firefox Web Browser

In the browser itself, only pop-up blocking is provided. This feature is set by default for every site opened in Mozilla Firefox. It is easy to disable it. You need to open a browser window, go to "Open Menu" (icon with stripes in the upper right corner) and select "Settings" from the list. In the window that appears, select "Privacy and Security" from the list on the left. Here scroll down the list and find the item "Permissions". Uncheck the box next to "Block pop-ups".


If the browser has manually installed plugins and extensions, then they are disabled like this:
  • Go to "Open Menu";
  • Select "Add-ons" from the list;
  • In a new window, from the list on the left, go to the "Extensions" item;
  • Find all blockers in the block in the center of the window and click "Disable";
  • Restart Mozilla Firefox.


Mozila, as in Google Chrome, provides the user with the ability to install a large list of extensions that disable ads. Therefore, you need to carefully review everything on the list.

Instructions for working with the Opera browser

Opera developers did a little differently. The browser has a powerful built-in ad-block and popup, but it is not activated by default. Therefore, if the user did not change the developer settings after installing, then the procedure for disabling the built-in functionality can be skipped. If the edits were made, then you can undo them by going to "Settings and Controls" (the Opera icon in the top left panel). Here select "Settings" and uncheck the box next to the first menu item.


When manually installing extensions, they can be canceled as follows:
  • Go to "Settings and controls";
  • Find and select "Extensions";
  • Select "Extensions" from the new list again;
  • In the block that appears, click the "Disable" button under the add-on that prohibits advertising;
  • Restart Opera.


All web browsers provide a function to disable and uninstall the plugin. If it disappoints - skips pop-ups, removes not all ads, etc., then you can remove it. Put a new extension instead. But if there are no complaints, it is better to perform a temporary shutdown in order not to repeat the installation procedure in the future.

If you asked yourself such a question, then you are a fairly experienced user and know about the existence of such an add-on as Adblock, which hides almost all ads from the eyes of users. Seemingly a useful plugin, so why disable it then? Undoubtedly, with its help, you can get rid of colorful and intrusive banners, teasers, clickers and other types of advertising that distract from the main content of the site with its colors or sounds. However, some sites start to display incorrectly, which makes it difficult to read articles, watch pictures or videos. That is why we decided to tell you how to disable the Adblock plugin in order to browse your favorite site in normal mode.

How to disable Adblock plugin in Chrome

First, we suggest looking at the disconnection process in the most popular browser today - Google Chrome! Well, we will not delay, straight to the point:

1. Open the menu by clicking on the button on the right side (located at the very top);
2. Click on "Settings", after which a page with settings opens, but we do not need it - we go further;
3. Switch from settings to "Extensions", after which a page with all the add-ons opens;
4. Uncheck the box next to the inscription "Enable";
5. Done! Now Adblock does not prevent your favorite site from being displayed in normal mode!

How to disable the Adguard plugin in Yandex Browser

Basically, everything is the same in Yandex browser as in Chrome, because they have the same source code. But we will still explain:

1. Click on the "Menu" button, which is on the top right;
2. A list drops out where you need to click on the "Add-ons" section;
3. The page with extensions opens. They are divided into categories;
4. Scroll it to the very bottom and find us the Adguard plugin (the same Adblock only specifically for Yandex Browser);
5. Move the slider opposite to it and the extension becomes inactive.

Disable the Adblock plugin in Mozilla Firefox

As you have already noticed, the process of disabling the plugin is practically the same in all browsers, only the names of the menu and the add-on itself (in the case of J. Browser) have been changed, and Mozilla was no exception:

1. We click on the same button to open the menu;
2. Click on the icon, under which is the inscription "Add-ons";
3. The extension store opens. We do not need him - we pass by;
4. In the menu on the left, click on "Extensions";
5. Actually, now the most interesting thing - we find among the plugins Adblock and click on the "Disable" button;

How to disable Adblock extension in Opera browser

And finally, let's please people who use Opera as their main browser:

1. Click on the "Opera" logo in the upper left corner, open the menu;
2. Hover the arrow on "Extensions" and go to the "Extensions Manager";
3. A page with installed plugins opens;
4. Find our favorite Adblock among the add-ons and disable it by clicking on the “Disable” button;

7 Answers


Use my plugin "FuckAdBlock", it can detect AdBlock very easily: https://github.com/sitexw/FuckAdBlock

FuckAdBlock.on (true, function () (alert ("AdBlock detected!");)). On (false, function () (alert ("AdBlock is not detected =)");));

javascript html

2018-11-27T00: 00Z

If you want to serve ads even when AdBlock is active, you will need to understand what AdBlock is capable of doing.

  1. AdBlock can block resources while loading
  2. AdBlock can hide certain elements in the DOM.

Although it is said that AdBlock can change CSS as well, I cannot find any documentation on this other than hiding and collapsing elements.

So what exactly could you do to be smarter than AdBlock?

You can mask your request in such a way that it is never "suitable" (eg http://domain.com/ae9a70e0a.png where the name of the image will be random every time and without a common prefix). As far as I know, a rule in AdBlock cannot contain a regex. The rule will be neither ads nor too many resources. It would be possible to rewrite such a URL on the server to point to your ad.

However, while AdBlock will not be able to block your ad from downloading, it will still be able to hide it. There is no real way to get around this. There is always a smart CSS selector that will -just- select your element. However, you can add a background image with content. This is not useful for an ad (not clickable), but may help you display a different message. The downside is that if someone chooses to block this annoying background image, it will hide your content as well.

As for the script, you can load the ad with an ajax request. I suppose (but cannot verify) that it will give an error if the resource cannot be loaded (because it was blocked). ($ .ajax (request) .error (function () (...)); in jQuery or some equivalent in plain javascript). You can use this to do something else. You can include this in the document itself instead of an external resource to ensure it always works (if javascript is enabled). Even then, you cannot be sure that "whatever you do" will never be visibly displayed. As a last resort, you can do window.alert (...). Let's say for 3 pages your visitors will never come back if you use this.

Another way I can think of is to do a websocket on the server (afaik, this cannot be blocked by AdBlock). On the server side, you will need to check if ad pages are not loaded when a specific page is loaded. This information can be sent over a socket, which can be used in your script to do something. This, however, seems crazy complex and is a significant overhead for "just" the script that AdBlock detects.

2018-12-11T00: 00Z

Function detect () (// create a iframe. Append the iframe to the body. And then after 100ms check if their offsetHeight, display or visibility is set such a way that user cannot see them. // In the URL use the words specific to advertising so that Adblock can do string matching.var iframe = document.createElement ("iframe"); iframe.height = "1px"; iframe.width = "1px"; iframe.id = "ads-text-iframe"; iframe.src = "http://domain.com/ads.html"; document.body.appendChild (iframe); setTimeout (function () (var iframe = document.getElementById ("ads-text-iframe"); if (iframe.style.display == "none" || iframe.style.display == "hidden" || iframe.style.visibility == "hidden" || iframe.offsetHeight == 0) (alert ("Adblock is blocking ads on this page "); iframe.remove ();) else (alert (" Adblock is not detecting ads on this page "); iframe.remove ();)), 100);)

2018-12-18T00: 00Z

In my case, ADB hid the content even when there were no ads. (Just because the ad word was present in many urls, because it was a post type pool).

But I noticed that they do not remove content by simply applying the display: none of them

Since an additional solution,

I just noticed that using display: block! Important; to body, prevents Adblock plus content from hiding

2018-12-25T00: 00Z

For me none of the tricks worked, maybe I was doing it wrong. but this is a very specific way to implement Google ads.

Window.onload = function () (if (document.getElementsByClassName ("google-auto-placed"). Length == 0) (// Adblock Detected))

If you plan to put this code in a separate .js file, make sure the filename is does not contain the word "Ad"... just name it magic.js

If Google ever decides to change the div name, this method will fail. but that seems unlikely.

2019-01-01T00: 00Z

Of course, this is an arms race and I support anyone's right to block ads, but I also support websites that rely on ad revenue trying to convince users otherwise, or perhaps convince them to subscribe or make a donation to compensate. lost ad revenue.I do not approve of sites that try to get users to see ads, but the polite message is fine.

Anyway, it's worth noting right now that there are many extensions / plugins for adblocking and they may have different ways of doing it, and sometimes they differ between OS and browsers. I found that for my purposes right now, this jQuery selector is enough to at least see if AdBlock or AdBlockplus is used, cross platform, at least in Chrome and Firefox:

If ($ ("div iframe: visible"). Length == 0) (// pop up a message or whatever)

2019-01-08T00: 00Z

I know this is a little old, but here is IMHO the best way to do it:
Add this to the section:

Now you can use the ab-message id wherever you want to display a message to AdBlock users:

Note that inline styling was added to hide it natively (of course, you can also do this from your own CSS file).
Also note that this takes 500ms, this is because it has to wait for the ad unit to do its job, or it won't work.

A little explanation of how this script works

First, it adds an iframe with a randomly generated link source. (It is generated randomly because some ad units are smart, at some point they realize that the link is fake).
Then it does some checks on that iframe (if it was loaded successfully or its styling was changed). If one of these tests is true, then it displays an ab-message element to adblock users.

This script works for most (if not all) ad blockers.

EXTRA

In fact, it couldn't have just been created an entity, but I created a Github project instead, but still, check it out and run it if it helps you.
abDetector: A simple JavaScript Adwords detector.
Enjoy.

This latest article was written to provide you with up-to-date information on removing unwanted links from Blogspot templates as well as new Blogger themes. As you know, there were changes in the Blogger codes in 2018, so many actions with the code need to be done in a new way. Plus, new topics have appeared that are formed differently. In connection with these changes, we will analyze the topic of deleting links.
You can check your blog for external links on the services https://pr-cy.ru/link_extractor/ and https://seolik.ru/links. Remember to check not only the blog home page, but also the posts (posts) and pages (Page). A large number of external links open for indexing are discouraged.

How to remove links from the old default Blogger template

Using the Simple template as an example.
These templates provide the most inbound links. In my test blog, when installing a simple theme, a check found 25 inbound links on the home page, of which 14 were indexed.
I remind you that before making changes in the template code, make a backup copy!
  1. Remove Blogger Link - https://www.blogger.com/. This link is enclosed in the Attribution widget. In the Blog Design tab, it appears as an Attribution gadget and. To remove it, go to the "Theme" tab -> change HTML. By searching for widgets (list of widgets), we find Attribution1 and delete all the code along with the footer section, in which it is enclosed. This is what the collapsed code to remove looks like:


    And here's the complete code:











    We save the changes and check the blog for Attribution.
  2. You've certainly seen the Wrench and Screwdriver icons on your blog for quick widget editing. Each such icon carries with it an external link to Blogger. Now they are closed with the nofollow tag, but you still need to get rid of them. You will edit the widgets in the Design tab.
    Here is a partial list of links that are encrypted in the wrench icons (the blog ID will be yours)
    - HTML1 Widget: http://www.blogger.com/rearrange?blogID=1490203873741752013&widgetType=HTML&widgetId=HTML1&action=editWidget§ionId=header
    - HTML2 widget http://www.blogger.com/rearrange?blogID=1490203873741752013&widgetType=HTML&widgetId=HTML2&action=editWidget§ionId=header
    - Blog archive: http://www.blogger.com/rearrange?blogID=1490203873741752013&widgetType=BlogArchive&widgetId=BlogArchive1&action=editWidget§ionId=main
    - Blog shortcuts: http://www.blogger.com/rearrange?blogID=1490203873741752013&widgetType=Label&widgetId=Label1&action=editWidget§ionId=main
    - Popular posts: http://www.blogger.com/rearrange?blogID=1490203873741752013&widgetType=PopularPosts&widgetId=PopularPosts2&action=editWidget§ionId=main
    All of these links are easy to get rid of. Search your blog template for the tag. It appears as many times as there are widgets on your blog. Remove all occurrences of the tag.
  3. Remove links to quick edit blog post (Pencil icon). Makes it easier to edit posts, but carries a threat as an external link of the form: https://www.blogger.com/post-edit.g?blogID=1490203873741752013&postID=4979812525036427892&from=pencil
    How to delete:
    Method 1. In the Design tab, edit the "Blog Posts" item and uncheck the "Show" Quick Edit "checkbox.
    Method 2. find the tag in the blog template and remove it. Save your changes and check your blog for the icon and link.
  4. Remove Navbar. Search for widgets in the navbar1 blog html template and remove all code along with the section.

    Namely:

    Now Navbar in the blog does not provide indexed external links, but I believe that this is an extra element that does not carry a functional load, and it is better to remove it.
  5. Remove external links to images. When you upload images to a blog post, a link is automatically embedded in them. To remove such links, you need to edit all blog posts. In the "View" mode and further to the "Link" icon. If the image does not contain an external link, then when you click on the photo in the post editor, the “Link” icon is not active (there is no icon highlighting).

  6. Remove the link to the blog author's profile. Remove the author of the blog below the post. To do this, find the code true and write false instead of true. It turns out false
  7. Close the link from the widget “” from indexing with the nofollow tag. If you are using the profile widget on your blog, use a quick widget search in the blog template to find the code for the Profile1 gadget. You need to edit the widget code, replacing rel = 'author' in two places with rel = 'nofollow' and add rel = 'nofollow' to two links. You should get something like the screenshot:


    Made on the example of editing a Google Plus profile. As a reminder, Google Plus will be phased out on April 2, 2019. Accordingly, after this date, you will need to make other changes in the code of the "About me" widget.

  8. We check for external links any blogspot post page that has been commented on. Find and delete the code in the blog template:

    In the Blog settings, along the path Blog settings -> Other -> Site feed -> Allow blog feed, apply the following settings:

Remove external links from the new default Blogger template

Using the Notable theme as an example
  1. Remove Attribution (link below - Blogger Technologies)
    Find Attribution1 in the widget search blog template (list of widgets) and delete the code along with the section similar to the old Blogger template (see above 1).
  2. Remove the link from the Report Abuse widget. This is the ReportAbuse1 widget. We find in the search by widgets:
    The whole code looks like this:
  3. We check the blog post page with comments and remove links by analogy with the old blog templates (see above - point 8).
  4. We grab links from blog posts that are sewn into post pictures (see point 5).

Ad blocking is a real problem for all bloggers and website owners who have their only source of income from advertising hosted on their own website. Let's take an objective look at the ways in which you interact with visitors that block ad serving. Attention! The ethical aspect is not covered in this article!

1. Don't do anything

Do not take this issue exclusively in black and white. Visitors who block ads are using server resources and loading the channel, but a site can benefit from users in less obvious ways. For example, a visitor will give friends a link to your article, photo or video. These acquaintances will visit the site and probably won't block ads. A visitor who blocks ads will leave a comment in the discussion, which is useful for the page from an SEO standpoint (if it is relevant, of course). The comment can be useful to readers or the author of the article.

In short, if you are an optimist. If all of the above applies to your site, the best solution is to take no action. In the case of the site, I am guided by these concepts and I am glad to any visitor, and advertising takes up less than 10% of the space from the content, I think this is tolerable.

2. Ask not to block ads

The site recognizes the blocking thanks to the use of "simulators" of advertising scripts (if the script is not executed, then the visitor is using programs like "adblock"). Explain, politely and calmly, that blocking ads prevents a site from loading completely harmless content. Ask the user to whitelist the site and the ad will load. This is a very elegant and efficient way to solve a problem. When a user realizes that useful content is hiding along with ads, he will probably make an exception for your site and add it to the white list.

There are many anti-blocking plugins for CMS WordPress that do their job perfectly and contain a lot of useful options.

For example, you can adjust the number of viewed pages after which the user sees your request. Indicates the position of the message: at the top of the screen or in a pop-up window.

On one of my sites, I show users this message (see below). If you want, download this picture for your site.

I highly recommend that you see what the user you are asking to see to allow the ad to load. If the page looks much nicer without ads, then it's worth working on its design. Personally, I think selective ad selection is a big step forward that brings us to the next chapter.

3. Work with verified advertisers

Advertising networks randomly pulls ads from their huge library, and among them often come across frankly low-quality and unscrupulous, calling to download some dubious software, win a free iPad or earn extra money. I am sure that site owners and developers should take a more responsible approach to the choice of advertising displayed on their own sites. Advertising is a necessity, which cannot be said about willful deception. Read the article on, don't get hung up on just one.

4. Set up a redirect

The most cruel way is to redirect users to another site, preventing them from watching your site. to the page, indicating on it the reasons why the user does not deserve information on your site. Particularly vengeful webmasters prefer to redirect to a site with shock content. This is, of course, the worst possible option, as it is extremely annoying to visitors.

Added to the loss of revenue due to blocked ads is a disgruntled visitor who could have become a regular user. Some site owners are fine with this approach, as ad blockers are not allowed to watch the content without giving anything in return. Especially if the very little is expected from visitors - to click on an advertising banner and download some 90 kilobytes of a page.

A dedicated WordPress plugin that would do an excellent job of this has not yet been developed. I wrote a small jQuery script to determine the size of the ad container after the page has loaded. If the size of the container is 0 pixels, then the ad has not loaded and a block has occurred. Before using the script, give the container a styled id for CSS, or place your ad code in div tags where you specify a specific id.

Place this code on the page (such a page will not pass validation for compliance with html-code standards, with the exception of HTML5, but this snippet will not affect the operation of the site in any way).

We will be happy to answer your questions and help you implement the described methods. Let's just stick to the technical side, and not talk about the moral aspects.

Adblock is a special add-on program that hides ads from users' eyes. It comes as an addition to the search engine, and its essence is to block pop-ups, banners and other unwanted information that distracts from viewing the main content of the web page.

The Adblock extension is as easy to disable as it is to activate. Sometimes there is a need to display all the materials on the site, or the information is displayed incorrectly, and there is no need to block ads - in this article we will take a closer look at how to disable Adblock in the most popular search engines - Google chrom, Yandex, Opera and Mozilla. We will also consider the features of connecting and disconnecting the Adblock program on phones, tablets and smartphones with software based on the Android OS.

How to disable adblock in Google Chrom

The Adblock extension is the most popular ad-blocking add-on to your web browser. There are different versions of this program, the most recent of them block not only advertising messages, but also malicious links while browsing the Internet. In different search engines, the principle of disabling this program is rather monotonous. Let's consider two ways to disable Adblock and Adblock Plus (enhanced version) in the Google Chrome search engine.

The first way

  • We open the browser.
  • In the upper right corner we find the icon of the Adblock program (in the example we will insert two extensions - Adblock and Adblock Plus, a more advanced version), click on it.


  • A menu window will open, select the "Pause program" option, click on it.


  • The Adblock program icon becomes inactive (green). To turn on the program, follow the same steps as when turning it off.


Second way

  • We open the Google Chrome search engine, in the upper right corner we find the "Settings and Management" icon, click on it.


  • In the menu that opens, we find the "Settings" option, go into it.


  • A window of internal browser settings will open, we do not need them. In the upper left corner, click the "Extensions" tab.


  • After clicking it, a list of extensions will appear on the screen, select Adblock and Adblock Plus from the list, uncheck the boxes opposite these programs.


  • After unchecking the boxes, the "Enabled" command will change to "Enable".


Third way

  • Open the search engine, in the open window, click the "Settings and Management" icon.


  • In the open menu, look for "Additional Tools", then "Extensions", uncheck the boxes opposite the Adblock programs. Extensions are inactive.


How to disable adblock in Opera browser

It will take a couple of minutes to disable the program for blocking ads in the Opera browser.

  • We open the search engine.
  • On the left of the taskbar at the very bottom, we find the extension icon in the form of a puzzle piece.


  • Click on it, find active extensions (Adblock), give the command "Disable". The extension is paused in the Opera browser.



How to disable adblock in Yandex

The Yandex search program is very similar to Google Chrome, and the differences between them are very minor. Consider disabling Adblock in this search engine.

  • We go to the Yandex browser.


  • In the upper right corner we find the Adblock icon - usually it is an open palm on a red background, click on it.


  • An additional menu will open, we perform the "Pause Adblock" operation.


  • After the operation "Pause Adblock" is completed, the extension icon will change to "Class" on a green background - this means that the application is inactive.


Disable adblock in Mozilla Firefox browser

Mozilla's search engine is becoming less and less popular against the background of more practical Google Chrome and Yandex, but many users still prefer this service as the most reliable and stable search engine. Consider disabling Adblock in this search engine.

  • Open the Mozilla browser.


  • In the upper right corner we find the already familiar program icon, click it.


  • The context menu is highlighted, select "Disable everywhere" there.


  • The Adblock extension is inactive, as indicated by the gray color of the icon.


Adblock program in the Android operating system

Using Adblock on phone devices, tablets and smartphones has its own characteristics. In Android, this extension comes as a separate web browser, with which you can search the Internet. At the same time, the program itself filters ads and malicious links, you only need to install this program yourself using the Google play service (Play Market).

If Adblock is installed on your device and you want to disable the ad blocking function, you will need to do the following:

  • Open the Adblock browser on your phone (tablet, smartphone).

  • We go into the browser settings (this is done using the left key on the touchscreen phone), find the "Options" menu, click on it.

  • In the "Parameters" we find the "Ad Blocking" option, which will allow you to set the desired blocking parameters, language and default settings.

We have looked at the examples of disabling Adblock in four different browsers, as well as the features of disabling ad blocking in the Android operating system. The Adblock extension also allows you to disable blocking on separately viewed pages by pre-setting certain settings. This supplement has many analogs, as well as different versions, which differ in target orientation and spectrum of action.