In my tests, JavaScript's reload()
function seems to prevent code that comes after it from executing... but can anybody confirm that this is true 100% of the time?
Assume the user has JavaScript enabled with no fancy tricks.
That is:
<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>