Emulate sendBeacon on Perplexity.ai

Emulate sendBeacon if beacon.enabled is disabled in Firefox for https://*.perplexity.ai/*

目前為 2025-09-29 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

作者
ohmylock
評價
0 0 0
版本
1.0
建立日期
2025-09-29
更新日期
2025-09-29
尺寸
1.2 KB
授權條款
MIT
腳本執行於

Emulate sendBeacon on Perplexity.ai

Description

This userscript emulates the navigator.sendBeacon method on websites under the https://.perplexity.ai/ domain. In recent Firefox versions, when the internal beacon.enabled setting is disabled, the native sendBeacon method does not function, causing issues with site features relying on it to send data asynchronously in the background.

The script overrides navigator.sendBeacon by using the modern fetch API with the keepalive: true option, closely mimicking the behavior of the original sendBeacon. This allows sending asynchronous POST requests without blocking page unload and with a high probability that data will be sent when the tab or page closes.

Features

  • Works only on https://.perplexity.ai/ sites
  • Emulates sendBeacon using fetch with keepalive
  • No need to manually change browser settings (no enabling beacon.enabled in about:config)
  • Ensures site functionality remains intact even if the browser disables sendBeacon
  • Small, self-contained script without external dependencies

Why use this script?

Firefox sometimes disables the Beacon API by default (when beacon.enabled is false), breaking functionality on sites relying on sendBeacon for analytics, logging, or telemetry. This script locally emulates sendBeacon on the site level, restoring functionality without compromising security or requiring user intervention in browser configuration.

Installation

  1. Install a userscript manager such as Tampermonkey or Greasemonkey.
  2. Install this userscript from Greasy Fork.
  3. Use https://*.perplexity.ai/ as usual — the sendBeacon method will work correctly even if disabled by the browser.

License and Security

This script is open source and contains no malicious code. The full source code is available for review before installation. It does not load external resources or send data to third parties.