如何制作一个广告封装程序,如果用户运行adblock则显示一条消息? [英] How to make an ad wrapper which displays a message if a user has adblock running?
问题描述
我有一个在每个网页上都有广告的网站。
I have a website with an ad on every page.
我想显示一条消息说:请考虑停用您的adblock,极大。如果用户已启用AdBlock。
I'd like to display a message saying, "Please consider disabling your adblock, it helps us out tremendously." if the user has AdBlock enabled.
这是我的尝试:
<div id="ad-wrapper">
<!-- Ad script here. It works fine. -->
</div>
和我的CSS:
#ad-wrapper {
background-color: #1D1D1D;
border: 1px solid #232323;
float: right;
height: 90px;
margin-right: 4px;
width: 728px;
overflow:hidden;
background-image: url('/Public/images/disabled-ad.jpg');
}
当我关闭AdBlock时,广告显示正确无误。
When I turn off AdBlock the ad is displayed correctly without issues.
当我打开它时,AdBlock完全使#ad-wrapper
不可见。
When I turn it on, AdBlock completely makes the #ad-wrapper
invisible. I thought it would only remove the ad, leaving my background-image message there for my users to see.
如何完成这个动作?
推荐答案
我假设广告代码封锁了您的包装,因为它包含ad一词。请尝试使用以下类似方式:
I assume Ad Block is blocking your wrapper because it contains the word "ad". Try using something like:
<div id="disabled-wrapper">
<!-- Ad script here. It works fine. -->
</div>
这篇关于如何制作一个广告封装程序,如果用户运行adblock则显示一条消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!