Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
@s-ui/react-ad-blocker-extension-detector
Advanced tools
> This component has only the logic of show content (i.e banner or message) through children when user has adblock. If you are using adblock just right now you should see a placeholder sentence like: <<"If you see this message you are using adblock extens
This component has only the logic of show content (i.e banner or message) through children when user has adblock. If you are using adblock just right now you should see a placeholder sentence like: <<"If you see this message you are using adblock extension">> in demo page. But if you are not using adblock or this extension is not enabled for this page, you won't see anything and this component won't render any kind of HTML layer, like div.
$ npm install @s-ui/react-ad-blocker-extension-detector --save
This component will receive by children the content that have to show when adblock extension is enabled in browser. For example could be a banner message. But at the same time maybe business dept could be interested in show a diferent page when adblock is enabled instead a banner.
This component render twice. The first time is for get the offsetHeight of div with class adsbox.
<div class="adsbox">nbsp;</div>
This class is the key because if offseight is equal to 0 is when adblock is enabled. Then we set the state through this condition, this causes a second rendering that will show our children content or anything depending if adblock is enabled.
import AdBlockerExtensionDetector from '@s-ui/react-ad-blocker-extension-detector'
return (<AdBlockerExtensionDetector>
<p>Simple message</p>
</AdBlockerExtensionDetector>)
import AdBlockerExtensionDetector from '@s-ui/react-ad-blocker-extension-detector'
return (<AdBlockerExtensionDetector>
<CustomComponent/>
</AdBlockerExtensionDetector>)
Find full description and more examples in the demo page.
FAQs
> This component has only the logic of show content (i.e banner or message) through children when user has adblock. If you are using adblock just right now you should see a placeholder sentence like: <<"If you see this message you are using adblock extens
The npm package @s-ui/react-ad-blocker-extension-detector receives a total of 259 weekly downloads. As such, @s-ui/react-ad-blocker-extension-detector popularity was classified as not popular.
We found that @s-ui/react-ad-blocker-extension-detector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.