1

I am writting an extension which collecting some information on a facebook page (don't use GraphAPI because of some reasons). As far as I known, the facebook page load is lazy loading, therefore I needs to scroll down to force the page loading more data. However the page load only if I active the tab, if I switch to other tabs, the page doesn't load and the extension is stuck.

I have researched on stackoverflow and google and it seems it is using page visibility API to stopping the loading. I have tried the solution in the following link but it doesn't work for facebook Chrome Extension: How to Disable Page Visibility API

for (event_name of ["visibilitychange", "webkitvisibilitychange", "blur"]) {
window.addEventListener(event_name, function(event) {
    event.stopImmediatePropagation();
}, true);

Is there any way to disable the page visibility api on facebook? Thanks in advance.

vtnguyen
  • 11
  • 1
  • The site may be using different check e.g. document.hasFocus() or even requestAnimationFrame. – wOxxOm Sep 21 '21 at 12:39
  • Be aware that Facebook doesn't allow you to scrape them so don't be surprised if you get banned. – WizKid Sep 21 '21 at 17:44
  • @wOxxOm I checked but I don't know which event is called when we leave focus from the active tab – vtnguyen Sep 22 '21 at 02:22
  • @WizKid I have put some delay to make the ext work like human, so my ext can work perfect if the tab is active – vtnguyen Sep 22 '21 at 02:24
  • @vtnguyen, put your current code in a [script element using a content script](/a/9517879) with `"run_at":"document_start"`. – wOxxOm Sep 22 '21 at 05:15

0 Answers0