I am working on creating a content script which provides live information next to a continuously changing page.
I have created a block of code which is executed every 3 seconds(not final pattern yet), and gathers data based on the current DOM, and injects information next to it.
The problem, the only DOM the script can see is the original one that was loaded at the point of 'document_idle', and changes after that point are not visible to my script.
Is there a way for my script to see the current DOM at any point in time?
manifest.json
{
"name": "Info Injector",
"version": "1.0",
"description": "Shows info",
"manifest_version": 2,
"content_scripts": [
{
"matches": ["https://*.boardgamearena.com/cantstop?*"],
"js": ["contentScript.js"]
}
]}
contentScript.js
window.setInterval(function(){
var e = window.document.getElementsByTagName("script")[16];
//console.log("e", e);
var tokens = e.innerHTML.substring(e.innerHTML.indexOf("tokens\":")+8, e.innerHTML.indexOf("\"wincolumns\"")-1);
console.log("tokens", tokens);
}, 3000);