I have a userscript that I use with Greasemonkey/Tampermonkey.
It's set to run on facebook.com
, where some pages are served from the backend during bootstrapping and others are loaded on the fly in the front-end using HRO, similar to how a Single Page Application (SPA) functions.
// ==UserScript==
// @name facebook
// @namespace nms
// @include http://*.facebook.com/*
// @include https://*.facebook.com/*
// @version 1
// @grant none
// ==/UserScript==
setTimeout( () => {
// generalStuff:
document.querySelectorAll(' #left_nav_section_nodes, .fbChatSidebar ').forEach( (e)=> {
e.style.visibility = "hidden";
});
}, 1000);
When I manually run this script in the console on SPA-like webpages, it works without any issues. However, when I try to execute it through Greasemonkey or Tampermonkey, it doesn't work on these specific types of webpages.
Is there a way to modify the script so that it functions correctly on SPA-style webpages as well?