Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including puppeteer-extra-plugin-anonymize-ua with all npm packages installed. Try it out:

var puppeteerExtraPluginAnonymizeUa = require("puppeteer-extra-plugin-anonymize-ua")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

puppeteer-extra-plugin-anonymize-ua v2.2.14

Anonymize User-Agent in puppeteer.

puppeteer-extra-plugin-anonymize-ua

A plugin for puppeteer-extra.

Install

yarn add puppeteer-extra-plugin-anonymize-ua

API

Table of Contents

Plugin

Extends: PuppeteerExtraPlugin

Anonymize the User-Agent on all pages.

Supports dynamic replacing, so the Chrome version stays intact and recent.

Type: function (opts)

  • opts Object Options (optional, default {})
    • opts.stripHeadless boolean Replace HeadlessChrome with Chrome. (optional, default true)
    • opts.makeWindows boolean Sets the platform to Windows 10, 64bit (most common). (optional, default true)
    • opts.customFn Function A custom UA replacer function. (optional, default null)

Example:

const puppeteer = require('puppeteer-extra')
puppeteer.use(require('puppeteer-extra-plugin-anonymize-ua')())
// or
puppeteer.use(require('puppeteer-extra-plugin-anonymize-ua')({
  customFn: (ua) => 'MyCoolAgent/' + ua.replace('Chrome', 'Beer')})
)
const browser = await puppeteer.launch()

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free