JS to determine whether the Web page ads blocked by the browser to filter the Code _JAVASCRIPT skills

Source: Internet
Author: User

Originally advertising money is not as good as the previous few years to do, and now most browsers have intercepted ads, many browsers or the default interception ads, webmaster is not generally hard ah! At present, the majority of small and medium-sized webmaster income or by advertising, advertising interception, the natural income will be greatly reduced.

At present, most of the browser's advertising blocking rules are ads blacklist + some advertising word matching, such as Baidu Alliance, Sogou Alliance, Google Alliance, even in the blacklist, the general advertising filter will filter out these Ads Alliance code. The rest is the advertising word matching, such as JS address contains ads.php, ad.js or even gg.js are likely to be filtered, 360 browser will even contain ad.gif, 960x90.jpg with advertising words of the image address will be shielded. If we put our own customized ads on our own, we must try to avoid these advertising words.

Facing the advertisement is intercepted, lets the browser put your website to add the white list, impossible! Let the browser cancel the ad interception function is more impractical. We can only be as far as possible to reduce the loss, the following fire-end network to write a JS to determine whether the Web page Ads browser blocking the filter code, after using a variety of browser testing, basically can accurately judge. This allows us to judge and then prompt the user to turn off the ad interception function, or to replace the original ad with a custom ad, or to make a hard point of direct access to the user (not recommended).

The judgment code is as follows:

<script src= "Http://demo.jb51.net/js/2015/adview_pic_cpc_cpm_cpa_guanggao_gg_ads_300x250.js" type= "text/ JavaScript "></script> 
<script type=" Text/javascript ">
if (typeof (killads) = = ' undefined ') { Alert (' Ad filtered ');}
</script>

In fact, the content of this JS file is a function judgment statement

var killads = true;

The adview_pic_cpc_cpm_cpa_guanggao_gg_ads_300x250.js can be downloaded, but please do not change the filename.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.