meta refresh 和 window.location.href 同时跳转时的时间执行顺序

2020-06-04 | By Jinyang | Filed in: Uncategorized.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>test</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="-1">
    <meta http-equiv="refresh" content="0; url='http://www.baidu.com'">
</head>
<body>
<div style="margin:30% auto;text-align:center; ">
    <p> 
    test
    </p>
</div>
</body>
<script type="application/javascript">
    try {
        window.location.href='http://www.sogou.com';
    }
    catch(err) {
        alert(err.message) ;
    }
</script>
</html>


One comment on “meta refresh 和 window.location.href 同时跳转时的时间执行顺序

  1. Jinyang说道:

    执行结果为: 执行底部的JS跳转。

发表评论

电子邮件地址不会被公开。 必填项已用*标注