<meta>标签的定时跳转、刷新
需求场景:一般用到的不太多,暂时遇到的只有提交的时候,跳转到等待页面(里面有倒计时或者是一个图片倒计时gif)的时候
解决方法: 在该等待页面使用<meta>标签,或者js的定时方法
一 <meta>标签
<!---使用标签跳转 3秒后在本页面跳到新页面--> <meta http-equiv="Refresh" content="3; URL=orderList.html"> <!---题外: 每隔30秒后刷新, 特别那种适合可视化数据分析, 每隔几秒几分钟, 刷新一下, 重获新数据--> <meta http-equiv="Refresh" content="30">
这种方法, 我测的过程中, 没有看到浏览器的前进和返回 , 应该回退不了
二 js的setTimeout 或者setInterval
setTimeout(function(){ // window.location.href="orderList.html"; // 在同当前窗口中打开窗口 window.open("orderList.html"); // 新标签页打开 },3000)

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>第一个</title> </head> <body> 第一个页面 测试3秒跳转orderList页面 <button onclick="hanleskipPage()">点击</button> <script src="../jquery-2.1.4.min.js"></script> <script> // 到时间3秒 function hanleskipPage(){ setTimeout(function(){ // window.location.href="orderList.html"; // 在同当前窗口中打开窗口 window.open("orderList.html"); // 如果浏览器不拦截的话 会新标签页打开 },3000) } </script> </body> </html>
我用的setTimeout , 不会用setInterval ,大概这样
// 跳转 function skipPage(){ window.location.href="orderList.html"; // 在同当前窗口中打开窗口 } // 每3秒 调用一次skipPage()函数 function hanleskipPage(){ var num = setInterval(function(){ clearInterval(num); // 停止num的skipPage()函数的执行: skipPage(); },3000); }

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>第一个</title> </head> <body> 第一个页面 测试3秒跳转orderList页面 <button onclick="hanleskipPage()">点击</button> <script src="../jquery-2.1.4.min.js"></script> <script> // 跳转 function skipPage(){ window.location.href="orderList.html"; // 在同当前窗口中打开窗口 } // 每3秒 调用一次skipPage()函数 function hanleskipPage(){ var num = setInterval(function(){ clearInterval(num); // 停止num的skipPage()函数的执行: skipPage(); },3000); } </script> </body> </html>
<meta>标签还有很多需要学的...
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
2019-08-26 给<label>点击事件时, 竟然点击了两次