Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@s-ui/react-ad-blocker-extension-detector

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@s-ui/react-ad-blocker-extension-detector

> 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

  • 1.4.0
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

AdExtensionAdBlockDetector

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.

Installation

$ npm install @s-ui/react-ad-blocker-extension-detector --save

Usage

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.

How it works technically?

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.

Basic usage

Display a simple message:
import AdBlockerExtensionDetector from '@s-ui/react-ad-blocker-extension-detector'

return (<AdBlockerExtensionDetector> 
          <p>Simple message</p>
        </AdBlockerExtensionDetector>)
Display your custom component:
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

Package last updated on 10 Feb 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc