作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在每天晚上 8:59 的特定时间刷新我的 wordpress 主页。我对 CSS 和 HTML 略有了解,但对 Javascript 几乎一无所知,所以如果您能详细解释解决方案,那将非常有帮助。
具体用例是我要嵌入预定的 Facebook 实时流,如果用户在流开始之前已经加载了网站,则需要刷新。我们的节目在晚上 9 点开始,直播在 8:59 开始,所以如果我们可以在 8:59 强制自动刷新,我们就可以确保没有人错过直播(我们的观众主要由年纪不大的人组成精通技术)。
提前致谢!
最佳答案
setInterval(function(){
const date = new Date();
const hour = date.getHours();
const minute = date.getMinutes();
console.log(hour, minute);
if(hour == 8 && minute == 59){
location.reload();
}
},1000);
Returns the hour in the specified date according to local time. If UTC is desired, use new Date(Date.UTC(...)) with the same arguments.
关于javascript - 如何在一天中的特定时间自动刷新 wordpress 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54847193/
我是一名优秀的程序员,十分优秀!