I am working on a web script in Chrome with an extention. I found this:
"content_scripts": [{
"js": [.....],
"matches": ["http://*/*", "https://*/*"],
"run_at": "document_start"
}]
In my Js script, there are just two lines of code:
window.test = 'test';
console.log(window.test);
And I tried to open my web page in this condition:
- Without opening the chrome devtool, I opened a new tab and go to my web page
- I checked the console.log in my code is displayed in my console. But, When I continue to enter window.test or test, i found the result of both of them are undefined.
P.S.
- I tried to change the 'document_start' to 'document_end', and these two global variables are defined, there is no bug.
- For the content scripts, I tried to write a new vide content script or with the content 'console.log...', but this way didn't work, so it is not the problem of the content of content script
I need to ask your ideas, if you want, you can try your chrome and your extension.