[英]How to auto redirect from one URL to another
我想為iframe
編碼提供一點幫助,以專門從一個URL重定向到另一個URL,而無需用戶單擊要重定向的任何內容。
iframe id =“ schedulista-widget-00” src =“ https://www.schedulista.com/schedule/neecostylez?mode=widget&rt_url=http%3A%2F%2Fwww.neecostylez.com&rt_text=Click+HERE+to+return + to + the + site“ allowtransparency =” true“ frameborder =” 0“ scrolling =” no“ width =” 100%“ height =” 900px“>
一切正常,除了我不希望用戶必須單擊以進行重定向並且無法看到指定為“單擊此處”的文本。 我只希望它被重定向。
我找到了下面的代碼,但是我不確定在哪里插入為取得成功結果所需的詳細信息。
<html>
<head>
</head>
<body>
<a id="link" target="_parent" href="outsideDomain.html"></a>
<script type="text/javascript">
document.getElementById('link').click();
</script>
</body>
</html>
只需使用meta http-equiv
標簽將頁面“刷新”到新的url,如下所示:
<meta http-equiv="refresh" content="0; url=/path/to/go/to/file.html">
內容設置要等到重定向用戶的時間, URL設置要重定向用戶的位置。
在這里了解更多
您可以使用提及的meta http-equiv標簽,如k97513。 您還可以如下使用JavaScript。
<script>
window.location = "https://www.google.com";
</script>
只需將其放在body標簽中,然后將Google替換為您要重定向到的所有URL。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.