在我的测试中,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>