我想禁用 <script>
标签。这是我的代码,但它不起作用。
document.getElementsByTagName('script').disabled = true;
最佳答案
事实上,可以通过改变“type”属性来禁止执行:
<script type="text/javascript">
alert("I will alert you");
</script>
<script type="application/json">
alert("And I will keep silent");
</script>
<script>
alert("I will alert too");
</script>
关于javascript - 如何使用 JavaScript 禁用 <script> 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9850317/