Greasy Fork

来自缓存

Greasy Fork is available in English.

Facebook Anti-Refresh

Prevents Facebook from auto-refreshing the news feed

< 脚本 Facebook Anti-Refresh 的反馈

提问 / 留言

§
发布于:2025-06-17

This script seemed like a godsend, but it doesn't work for me.

I've installed v1.2 of the Facebook Anti-Refresh script in Firefox (v139.0.4 64b) running Tampermonkey (v5.3.3).
It is active. The console shows: [FB Anti-Refresh] Starting... // Visibility API overridden // Protection active.

It doesn't matter if I just read a post on my timeline, or I press 'nn Comments' so it opens in a pop-up and I can read all the comments -- if I go to a different tab for a couple of minutes and then return to the FB tab, the timeline will refresh as always and I can't finish reading it or its comments.

Areen-c, I hope you can get it to work, or help me to do so if the problem should be on my side.

areen-c作者
§
发布于:2025-06-17

This script seemed like a godsend, but it doesn't work for me.

I've installed v1.2 of the Facebook Anti-Refresh script in Firefox (v139.0.4 64b) running Tampermonkey (v5.3.3).
It is active. The console shows: [FB Anti-Refresh] Starting... // Visibility API overridden // Protection active.

It doesn't matter if I just read a post on my timeline, or I press 'nn Comments' so it opens in a pop-up and I can read all the comments -- if I go to a different tab for a couple of minutes and then return to the FB tab, the timeline will refresh as always and I can't finish reading it or its comments.

Areen-c, I hope you can get it to work, or help me to do so if the problem should be on my side.

Hi danielvr, thanks for the detailed report and sorry for the trouble.

You're not doing anything wrong, this is a really frustrating issue. The way my script works is by blocking the website's code from telling the browser to refresh when you switch tabs. However, what's likely happening in your case is a separate issue that my script can't control: the browser itself is deciding to unload the tab to save memory.

Firefox has a built-in feature on desktop (browser.tabs.unloadOnLowMemory) that automatically discards inactive tabs when your system's memory is low, and on Android this is an even more aggressive and known bug (https://bugzilla.mozilla.org/show_bug.cgi?id=1752594). When this happens, the page isn't just refreshing, it's being reloaded from scratch, which is why my script can't prevent it.

As a possible alternative, you could try using uBlock Origin Scriptlet. On one of my devices, adding this filter to "My Filters" in the uBO dashboard works perfectly for both Facebook and Reddit:

facebook.com##+js(aeld, /blur|focus|afterblur|mousemove|visibilitychange/)

I haven't tested it on other machines, so I'm not sure if device specs make a difference, but it might be worth a shot.

I'll try to look into a better fix for the script when I have some free time. Thanks for your patience!

§
发布于:2025-06-21

Hi Areen-c, thanks for your quick reply! I have turned "browser.tabs.unloadOnLowMemory" off, but that did not make a difference. Also, these refreshes are limited to Facebook, I've never seen another tab refresh itself spontaneously.

I forgot to say, but I'm on Win 11 Pro 64b. And maybe this is relevant: I'm using the NoScript plug-in, which disables scripts from 3d party servers.

areen-c作者
§
发布于:2025-06-21

Hi DanielVr, thanks for the additional info! Have you tried that uBO filter yet? I can confirm on my two Win 10 and Win 11 devices that this filter successfully blocks Facebook's refresh:

facebook.com##+js(aeld, /blur|focus|afterblur|mousemove|visibilitychange/)

It works perfectly for preventing those timeline refreshes when switching tabs. Much more reliable than the Tampermonkey script approach. Let me know how it works for you!

§
发布于:2025-07-07

I finally got around to trying UBlock, and your filter. After a restart of Firefox I think it's now working! Thank you kindly!

§
发布于:2025-07-12
编辑于:2025-07-12

Having used it for a few days, the uBO Facebook filter does work well, but it also has a few undesirable side-effects:

- I cannot press [enter] in some fields. For instance, when I want to use the Search function on someone's profile, I can type the keyword that I want to search for, but nothing happens when I press enter.

- When I click on a photo and press '+' to enlarge it, I can no longer click-and-drag with the left mouse button to move the image around.

I'd be grateful for possible solutions.

发布留言

登录以发布留言。