JS判断跳转来源跳转指定页面

2020-02-15  本文已影响0人  CDwalker

判断跳转来源地址是否是指定域名/地址下,如果是正常跳转,不是跳转其他页面

<html>
<head>
<script type="text/javascript">
        if (document.referrer.indexOf("demo123.com") > -1) {
        } else {
        window.location.href='demo_location.html';
        } 
        </script>
</head>
<body>
</body>
</html>
上一篇 下一篇

猜你喜欢

热点阅读