In background.js, the code checks the element

var online = document.getElementById("online"); if (online.innerHTML == "online") { //тут должно быть оповещение }; 

I tried to implement it by examples, nothing happened, and it's difficult to google (it gives all kinds of nonsense off topic). I tried to read the documentation through a translator (everything is difficult with English), too, it turned out a little.

Can you tell me what code will alert me? + I would also like to increase the number in the extension icon. And what will need to be added to manifest.json. Well, or information on how to implement it in Russian.

  • If your background.js is really what it is called, then no document is available to it. Rather, there is a backround document that you will not see in the browser and no warning will go anywhere. Through the means of the developer, in principle, you can get to this window, but there’s no special meaning. To work with a document opened in the current tab, you need a content script, it is separately described in the manifest. - Mike
  • @Mike but I need the work to be with the document NOT open in the tab. That is, alerts can be made only when the document is open in the tab? - ThreegunD
  • @Mike and yes, I know about the background document, there I ship the document itself, then from there I get the one I need. The only thing I could do was play the sound through background.js. But I would like some visible alert. - ThreegunD
  • If the usual alert is yes, alerts in the tab are shown and accessible only to the content. You can of course open the popup window and write in it, but again this is not a background. You can go to the extensions menu, turn on the "Developer mode" checkbox at the top and click on the "Background page" beside your extension, then you will have a separate window with your background.js, and there will be a regular console from which you can see everything that is in it and your script can easily display it using console.log () - Mike
  • @Mike I also know about the console. In the popup, I completely betray the entire result (300 items are checked every 10 seconds and then goes to the popup), it’s just to wait for a long time and I am late sometimes. I didn’t mean alert. It’s like in gmail for example, or there are extensions for VC that notify about a new message, even if VC is not open. There is a small window on the bottom right. How do I implement this? - ThreegunD

0