Facebook Anti-Refresh

Prevents Facebook from auto-refreshing the news feed

这些是此脚本的所有版本。 只显示代码变更过的版本。

  • v1.2 2025-06-02

    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!

  • v1.1 2025-05-13

    V1.1 - 2025-05-14

    ⚠️ Known Bug

    • Closing Facebook posts by clicking outside the post area causes redirect to top of feed
    • Workaround: Use ESC key or X button to close posts
    • Script prevents refresh but cannot prevent the redirect behavior
  • v1.1 2025-05-13

    Version 1.1 - 2025-05-14

    ⚠️ Known Bug

    • Closing Facebook posts by clicking outside the post area causes redirect to top of feed
    • Workaround: Use ESC key or X button to close posts
    • Script prevents refresh but cannot prevent the redirect behavior
  • v1.1 2025-05-13

    Changelog

    Version 1.1

    • Prevents Facebook from detecting tab switches
    • Blocks auto-refresh when returning to Facebook tab
    • Overrides Page Visibility API (visibilityState, hidden)
    • Supports browser prefixes (mozHidden, webkitHidden)
    • Blocks visibility change events on document
    • Blocks blur and mouseleave events on window
    • Prevents refresh requests after 60 seconds of inactivity
    • Tracks user interactions to prevent unnecessary blocking
    • Makes document.hasFocus() always return true
  • v1.1 2025-05-13

    facebook anti-refresh: fix typo

  • v1.0 2025-05-13

    facebook anti-refresh: fix various known bug, approach with another method

  • v1.0 2025-05-13

    ### 1.0 - Initial Release
    ✨ Features:
    - Override Page Visibility API
    - Block auto-refresh network requests
    - Prevent automatic scroll to top
    - Monitor DOM changes for refresh detection
    - Track user interaction timing

  • v1.0 2025-05-13

    ✨ Features:
    - Override Page Visibility API
    - Block auto-refresh network requests
    - Prevent automatic scroll to top
    - Monitor DOM changes for refresh detection
    - Track user interaction timing

  • v1.0 2025-05-13 Imported from URL