Similar to this I want inject the js files that are external to the html.
Background to my issue -- I am using cobertura for code coverage generation for my Angular6 application. In my vsts build I am publishing the code coverage results, but when stepping through the file links when .js files need to be fired I get errors in the browser:
Blocked script execution in '<URL>' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
I figured the best solution would be to execute a script to inject the javascript code directly into the html rather than linking to it externally.
so for example say the html is like this:
<html>
<script src="code.js"></script>
...
</html>
then after running a script like injector.js
like so: node ./injector.js
the html will become:
<html>
<script>
function hello() {
console.log('hello');
}
</script>
</html>
How can you do this?
or is there a better solution to this problem?