0

// 当我创建这个 html 页面时,它只是重定向到第一个 url,五分钟后我将如何重定向到下一个 url,我无法对 url 进行任何更改,我只能更改这个网页。

<HTML>
<HEAD>
<TITLE>I moved!!!</TITLE>
<META HTTP-EQUIV="refresh" CONTENT="5;URL=http://url1">
<META HTTP-EQUIV="refresh" CONTENT="300;URL=http://url2">
<META HTTP-EQUIV="refresh" CONTENT="300;URL=http://url3">
<META HTTP-EQUIV="refresh" CONTENT="300;URL=http://url4">
</HEAD>

<BODY>

Your browser should automatically take you there in 5 seconds. If it doesn't please go     to http://my.newplace.com/

</BODY>
</HTML>

你能告诉我吗?干杯

4

4 回答 4

0

There is now way for a page to tell the browser to do something after it has left the original page.

The instruction to redirect to the third page would have to come from the second page, not the first page.


You could implement something with frames, so that the page giving the instruction to redirect is never left, but that is rather icky and won't place nice with framebusters.


You might want to investigate writing a browser extension to do this instead.

于 2013-04-11T09:15:53.147 回答
0

您应该在重定向中持久存储一些数据,例如将它们存储在cookie中。此 cookie 应包含指示哪些页面已用于重定向的数据。对于更细粒度的控制,请改用 JS。

这个伪代码应该可以帮助你

var urls = [
      {url:'example.com',time:180000},
      {url:'example2.com',time:190000},
      ... and so on
    ]
  , indexToUse = readCookie('nextIndex') || 0
  ;

setTimeout(function{
  setCookie('nextIndex',indexToUse++);    //set the next index
  window.location = urls[indexToUse].url; //redirect page
},urls[indexToUse].time);
于 2013-04-11T09:15:00.637 回答
0

在第一个元之后,您在页面 url1 上,因此您需要在那里放置下一个元。

于 2013-04-11T09:17:59.847 回答
0

我能想到的唯一方法是使用 AJAX 并将页面加载到框架中。但是地址栏中的 URL 不会改变,除非在所有 AJAX 请求完成后发生元刷新,否则您将始终位于初始页面上。

但我相信这是你唯一的解决方案,如果你不去浏览器插件路由,或者在其他 URL 上放置元重定向(我认为这是你可能不会追求的东西,但我不知道你的项目的范围)。

于 2013-05-22T17:33:33.060 回答