I do know that inline scripts cannot be executed since it disobeys their Content Security Policy. However, when something like<script src="whatever.js"> is mentioned, it doesn't execute at all. It doesn't send a request out to the js file mentioned or anything. Any answers as to why this is?
Asked
Active
Viewed 32 times
0
Syndiate
- 27
- 4
-
It just works. There must be something wrong in your case so the question needs [MCVE](/help/mcve) otherwise it's not answerable. One guess though: if you read the template and add as html dynamically, its scripts won't run so you'll need to add each one as an element individually. – wOxxOm Mar 23 '21 at 04:59
-
@wOxxOm well the way that I'm doing it is I'm making a "let" variable which contains an html template, and then using a function in the content script that cleans the original page clean and replaces it with the "let" variable. Basically, I'm not using a separate html file in the extension, but I'm using HTML that is cited in the content script itself. – Syndiate Mar 23 '21 at 19:20
-
So my guess above was right on the money. See [Executing elements inserted with .innerHTML](https://stackoverflow.com/q/2592092) – wOxxOm Mar 23 '21 at 19:35