Greasy Fork

来自缓存

Greasy Fork is available in English.

Facebook Anti-Refresh

Prevents Facebook from auto-refreshing the news feed

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

作者
areen-c
日安装量
0
总安装量
82
评分
1 0 1
版本
1.2
创建于
2025-05-13
更新于
2025-06-02
大小
4.3 KB
许可证
MIT
适用于

Facebook Anti-Refresh Userscript

This userscript prevents Facebook from auto-refreshing your feed when you switch tabs. It keeps your place in the timeline instead of that annoying refresh that makes you lose everything you were reading.

Features

  • 🚫 No more losing your place in the feed
  • 💯 Works with latest Facebook interface
  • 🌐 Supports multiple Facebook domains
  • ⚡ Lightweight and efficient

Installation

  1. Install Tampermonkey or Violentmonkey
  2. Click Install on this page
  3. Script runs automatically on Facebook

How It Works

  • Overrides Page Visibility API
  • Intercepts refresh network requests
  • Blocks visibility events
  • Tracks user activity

Changelog

Version 1.2 (June 2, 2025)

🆕 What's New

Fixed the script completely freezing Facebook. Yeah, that was bad.

🐛 Bug Fixes

  • Fixed "Cannot assign to read only property 'reload'" error - Removed the location.reload override that was causing TypeError spam in console
  • Fixed Facebook becoming unresponsive - Removed overly aggressive MutationObservers that were watching every single DOM change
  • Fixed performance issues - Removed the 5-second re-application loop that was hammering the CPU for no reason

🔧 Technical Changes

  • Simplified network interception - Now only blocks specific refresh endpoints instead of analyzing every request to Facebook
  • Removed unnecessary features that were causing more harm than good:
    • WebSocket interception (wasn't helping with refresh anyway)
    • Service Worker blocking (overkill)
    • Aggressive script injection monitoring
  • Better error handling - Added try-catch blocks so one error doesn't break everything
  • Lighter activity tracking - Only tracks essential user interactions (click, scroll, keypress)

📈 Performance

  • Before: Facebook freezing, console errors, high CPU usage
  • After: Smooth experience, minimal overhead, no errors

💡 Developer Notes

Turns out trying to block EVERYTHING Facebook does is a terrible idea. This version takes a much more targeted approach - only blocking what's actually needed to prevent the refresh. If it works, don't touch it!


Version 1.1 (Original)

⚠️ Known Issue

To close Facebook posts, use ESC key or X button only. Clicking outside triggers redirect to top of feed. Script prevents refresh but not the redirect.

See screenshot below for details.