@Barrgi
I've tested it in Opera on Windows. Before installing it, Facebook refreshed every time I returned to the tab after a few minutes. After installing it, the page stays exactly where I left it. Facebook may still show a "Refresh" or "See new posts" button, but it no longer refreshes the page automatically.
Hopefully this helps someone else who finds this thread.
Here's what worked for me:
Install the Tampermonkey extension.
Create a new userscript.
Paste the following script and save it:
// ==UserScript==
// @name Facebook - Stop Auto Refresh
// @namespace https://facebook.com/
// @version 1.0
// @description Prevent Facebook from auto-refreshing when returning to the tab
// @match https://www.facebook.com/*
// @match https://web.facebook.com/*
// @run-at document-start
// @grant none
// ==/UserScript==
(function () {
'use strict';
Object.defineProperty(document, 'hidden', {
get: () => false
});
Object.defineProperty(document, 'visibilityState', {
get: () => 'visible'
});
document.hasFocus = () => true;
const blocked = [
'visibilitychange',
'webkitvisibilitychange',
'blur',
'focus',
'pagehide',
'freeze'
];
const originalAdd = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(type, listener, options) {
if (blocked.includes(type))
return;
return originalAdd.call(this, type, listener, options);
};
window.onfocus = null;
window.onblur = null;
})();