简体   繁体   English

如何自动从一个URL重定向到另一个URL

[英]How to auto redirect from one URL to another

I would like a little help with iframe coding to specifically redirect from one URL to another without the user having to click anything to be redirected. 我想为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"> 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“>

Everything works fine except I don't want users to have to click to be redirected and not be able to see the text specifying to "click here". 一切正常,除了我不希望用户必须单击以进行重定向并且无法看到指定为“单击此处”的文本。 I just want it to be redirected. 我只希望它被重定向。

I found the below code but I'm not sure where to plug in the details needed to put in order for successful results. 我找到了下面的代码,但是我不确定在哪里插入为取得成功结果所需的详细信息。

<html>
  <head>
  </head>

  <body>
    <a id="link" target="_parent" href="outsideDomain.html"></a>
    <script type="text/javascript">
      document.getElementById('link').click();
    </script>
  </body>
</html>

Simply use a meta http-equiv tag to "refresh" the page to a new url as follows: 只需使用meta http-equiv标签将页面“刷新”到新的url,如下所示:

<meta http-equiv="refresh" content="0; url=/path/to/go/to/file.html">

The content sets how long to wait until to redirect the user, and the url sets where to redirect the user. 内容设置要等到重定向用户的时间, URL设置要重定向用户的位置。

Read more about it here 在这里了解更多

You could use the meta http-equiv tag as k97513 mentioned. 您可以使用提及的meta http-equiv标签,如k97513。 You could also use JavaScript as follows. 您还可以如下使用JavaScript。

<script>
    window.location = "https://www.google.com";
</script>

Just place that in the body tag and replace Google with whatever URL you want to redirect to. 只需将其放在body标签中,然后将Google替换为您要重定向到的所有URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从一个URL重定向到另一个URL? - How to redirect from one URL to another URL? 我如何使用reactjs中的路由从加载到另一个URL后从一个页面重定向 - How could i use the routing in reactjs to redirect from one page after loading to another url 如何将用户从一个 url 重定向到另一个具有 JavaScript 操作(例如添加到购物车)的网站 - How can I redirect users from one url to another website that has a JavaScript action like add to cart 自动将所有链接从一个基本 URL 重定向到另一个? - Redirect automatically all links from one basic-URL to another? 如何将网页从一个域重定向到另一个域? - How to redirect webpage from one domain to another? 如何从一页重定向到另一页 - How to redirect from One page to Another 如何在Express中从一个域重定向到另一个域? - How to redirect from one domain to another in Express? 如何根据他来自的 URL 将用户重定向到另一个 URL - How to Redirect User to Another URL Depending on the URL He Came From 使用AJAX从服务器获取数据后如何重定向到另一个URL?URL重定向不起作用 - How to redirect to another URL after fetching data from the server using AJAX?URL redirect not working 如何在另一个页面上重定向并从表中传递 url 中的参数? - How to redirect on another page and pass parameter in url from table?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM