0

I'm making a webbrowser extension. The ultimate goal of this would be to select an element that we don't wanna see in a webpage. My extension would remove it from the page (graphically) and would save a way to hide it every time you open up the page.
I've already done the part to select an element in the page and adding display: none to it. But now I need a way to save which node was hidden in order to hide it the next time this url is loaded.
I've inspected some major sites in order to see what's the best way to do this. And for now, I've figured out that I'll do it either with an id if the element has one or with his class list. Linked with the website url, this could work.
But I've alos figured out that this will bring me many problems.

  • What if the element has not a unique classlist.
  • What if the classlist changes in function of the state of the website
  • ...

And I'm not even talking about the website like google which encrypt and change their classes/id every now and then

So I feel like they should be an easier way to do this and I'm completly missing it. I've searched for a solution but I can't find a solution to this as searching for "chrome extension uniquely identify node with class/id", "chrome extension uniquely identify node" or "chrome extension save node" will get result polluted with nodejs.

In summary, in need a way to identify any node from the chrome extension

polypode
  • 501
  • 3
  • 14

0 Answers0