【掌握原生态前端JS】SSM中页面中延时跳转功能的解决方案以及使用iframe标签出现页面404的问题的解决方案以及子页面跳出iframe标签父页面的解决方案

本文提供了解决页面延时跳转、iframe加载404错误及子页面跳出父iframe的方法。包括HTML元标签、JavaScript定时器实现延时跳转,解决iframe加载问题的控制器配置,以及使用JavaScript检测并跳出iframe的技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一页面延时跳转功能的解决方案

1 
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="3;url=login.html">
<title>登录失败</title>
</head>
<body>
<h1>登录失败!稍等3秒,自动跳转到等界面</h1>
</body>
</html>
2

<!DOCTYPE html>  
<html>  
<head> 
<meta charset="utf-8">
<title>JavaScript</title>  
</head>  
<html>
<body>
<p>5s后跳转跳转</p>
<script type="text/javascript">
 function jump(){
    window.location.href='http://www.baidu.com/';
}
setTimeout(jump,5000);
</script>
</body>
</html>

二使用iframe标签出现页面404的问题的解决方案

因为iframe是使用src引用地址,所以想使用iframe标签必须在控制器中加上相应的控制器跳转

<iframe id="index"  src="index" style="width: 100%;border: 0;"></iframe>



@RequestMapping("index")
public String touser() {
    return "WEB-INF/index.jsp";
}

自己做项目遇到的问题 ,记录一下。

三子页面跳出iframe标签父页面的解决方案

1<script type="text/javascript"> 
if (top.location !== self.location) { 
    top.location=self.location; 
} 
</script>  
2<script type="text/javascript"> 
if (top.location !== self.location) { 
    top.location = "../index.jsp";//跳出框架,并回到首页 
} 
</script> 
3if(window.parent.length>0) 
         window.parent.location=location; 
//*******************
if (window != top) 
     top.location.href = location.href; 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

牵牛刘先生

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值