Vanishing an element with querySelector brings unending refreshes in some pages

A question from a beginner. I have this code:

document.querySelectorAll("#ploo, #tloo").forEach(function(element) { = "none";

I run a similar script with Tampermonkey and with different id’s. In some point I added another id to the list and saved the script. So far, so good.

After adding this extra id, I went back to the navigation bar and reloaded the webpage that contains this id. The moment that happened, the browser started refreshing the webpage without an end… Like in an infinite “F5 loop”.

This phenomenon happens time and again, in all pages containing an element with this id.

Why would this happen? Why would vanishing an element with a particular id or any other selector cause unending refreshes?

Hmmm that really makes no sense, unless there is another script behind doing some dodgy stuff… Are you 100% sure this is the case?

Yes, this is the case 100%… Given the website I try to hide divs in is Mark Zuckerberg’s Facebook, they might initiate such a mechanism whenever someone try to hide their “attention-conquering” sections and divs.

If you use Facebook, try to hide “People you may know” window in your Facebook profile page, and it might occur to you too…

That could explain a lot. I think you should look into

This seems to work: = "hidden"; without the refreshing problem.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.