The following is html. I want to delete the first script tag. I do not want to execute first script tag. I want to modify the html of the third party. In other words, I cannot modify original html directly. Therefore I am going to solve it using grease monkey.
<html>
<head>
<script type='text/javascript' src='alert1.js'></script>
<script type='text/javascript' src='alert2.js'></script>
</head>
<body>
</body>
</html>
The following is grease monkey script. first script tag is deleted. However, first script tag is executed.
// ==UserScript==
// @name testWeb
// @namespace ddddd
// @include https://localhost/test/a.html
// @version 1
// @grant none
// ==/UserScript==
var script = document.getElementsByTagName('script')[0];
script.parentNode.removeChild (script);
What should I do to delete first script tag without executing it?