在我的测试中,JavaScript 的reload()
函数似乎阻止了它之后的代码执行......但有人能确认这是100%的真实情况吗?
假设用户启用了 JavaScript,没有花哨的技巧。
那是:
<head>
<!-- Comes first in the <head>, and could be included via an external .js file. -->
<script type="text/javascript">
window.location.reload(true);
</script>
<!-- ... -->
</head>
<body>
<!-- ... -->
<!-- Later in the code. This could be js, html... or anything else. -->
<script type="text/javascript">
alert('this should NEVER display... regardless of OS/browser');
</script>
<!-- ... -->
<span class="you-cant-see-me">secret!</span>
<!-- ... -->
</body>