JS页面跳转
2016-10-27 本文已影响38人
槑如是
JS页面跳转就是很简单的一句话
<script>
window.location.href="www.myqing.cn";
</script>
上面的跳转,在目标页面中是无法获取来源的;如果需要知道目标网页时从哪里跳转来的,则可以用JS模拟一次点击,然后就可以满足需要了。
<script>
var aa = document.createElement("a");
aa.setAttribute("href","www.myqingmei.cn");
var bodys = document.getElementsByTagName("body")[0];
bodys.appendChild(aa);
aa.click();
</script>