dpea85385 2017-03-21 19:58
浏览 55

如何在计时器上重定向或关闭网站?

I have a website (built in Wordpress) that needs to close after a visitor has been there for 5 minutes. (The people visiting are taking a survey that links out to this page and I need to get them back to the survey after browsing the outside website for five minutes). Displaying a countdown timer in a top corner would be great but not necessary.

I figured out how to get Javascript to close a page on a timer BUT I want the visitors to be able to browse multiple pages without a) me having to place the timer on every page and b) the timer resetting.

This is the webpage: http://www.cancerclinicalstudyguide.com

Thanks

  • 写回答

2条回答 默认 最新

  • douzhong2954 2017-03-21 20:08
    关注

    There are a few ways to solve this.

    1. Use Cookies and use setInterval to update the cookie every second
    2. Use AJAX to dynamically load the content (This can be a bit of a hassle)

    You could also not use a timer. I don't really get why you want to restrict the time the users have.

    评论

报告相同问题?

悬赏问题

  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探