I'm very close to the fact that the Chrome Extend extension works just fine, but now I am launching the last question.
The problem seems to be related to the fact that the contents of the script are re-injected into sites like Facebook, where the entire page does not reload when the link is clicked, etc.
I think the problem is that the site is very dependent on AJAX.
If I refresh the whole page or load it for the first time, then there is no problem. My extension is executed, and the contents of the script are being entered correctly.
However, if I load the page in normal time, and then click on the link on the site, the Facebook βContentβ section will load any link that you clicked on, while the floating blue navigation bar at the top does not update or change at all.
those. the whole page does not reload. Since the "content section" of the site and the navigation bar are in the same frame, the content of the script simply continues to be entered at a different time for each link you select.
So, in the end, I see in my console log that it works 2X, 3X, 4X, 5X, etc. When I click on other links, the number increases by 1 each time.
So my question is this:
Is there an easy way to check if the content of the script is ALREADY / active before entering it again? Or what else can be used as a workaround for such a situation?