JavaScript reload()是否会阻止页面的其余部分被处理?

时间:2011-12-07 06:15:38

标签: javascript refresh reload browser-refresh order-of-execution

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

0 个答案:

没有答案