[英]How to redirect from html page?
僅僅為了信息,我想知道有沒有辦法從html頁面重定向到另一個,除了window.location.href
和window.location
???
有。
<meta http-equiv="refresh" content="0; url=http://example.com/" />
記得把它放在<head>
里面
我不知道為什么你忽略了上面提到的,無論如何你走了。
var url = "http://stackoverflow.com";
$(location).attr('href',url);
你可以用PHP做到這一點,但是為了前端目的:
您可能希望查看window.location.replace
因為它繞過了后退按鈕,這在重定向時通常非常煩人。
你可以把它放在頭上
<meta http-equiv="refresh" content="time; URL=your_new_url">
為例
<meta http-equiv="refresh" content="5; URL=test.html">
在test.html上5秒后重定向
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.