New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@datadome/service-worker-plugin

Package Overview
Dependencies
Maintainers
11
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datadome/service-worker-plugin

Plugin for service workers to intercept block responses from DataDome Bot Protect

latest
npmnpm
Version
1.0.1
Version published
Maintainers
11
Created
Source

DataDome Service Worker Plugin

Overview

This package overrides the global fetch function to hook requests and display challenges for blocked requests.

Installation

Prerequisites

  • Have the JS Tag set up on your app

Step 1: Install the Package

Install the package using the command:

npm i @datadome/service-worker-plugin

Step 2: Import the Plugin in Your Service Worker

Import the package into your service worker script.

For ES Modules

import '@datadome/service-worker-plugin';

For CommonJS

require('@datadome/service-worker-plugin');

Step 3: Configure the JS Tag

To enable the JS Tag to listen to the service worker, update its configuration to include the enableServiceWorkerPlugin option:

<script>
  window.ddjskey = 'YOUR_DATADOME_JS_KEY';
  window.ddoptions = {
      enableServiceWorkerPlugin: true,
  };
</script>

How it works

The fetch override is applied when the service worker is activated. The interception of requests and responses will be enabled as soon as the service worker is installed and ready to handle fetch events.

FAQs

Package last updated on 24 Apr 2025

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