通过document.referrer判断
a.html
<a href="b.html">浏览b.html </a>
b.html
<body>
<script type="text/javascript">
document.write(document.referrer); //打印
if(!document.referrer)//判断是否是直接访问还是通过链接访问过来
{
window.location = 'a.html' //跳转
}
</script>
</body