当前位置:网站首页>Page embedded iframe click browser back problem
Page embedded iframe click browser back problem
2022-06-23 07:04:00 【SeriousLose】
Page embed iframe Click the browser to go back
- stay iframe binding load event , In this way, you can listen to the open iframe Click browser back Button event ;
<div [hidden]="!iframePageDisplay" class="iframeStyle">
<iframe [src]="iframeUrl" width="100%" height="100%" frameborder="0" id="message" name="nameOfThematicProgrammes" (load)='iframeOnload()'></iframe>
</div>
- load Incident , open iframe,push Go in one history;
iframeOnload(){
if(this.iframePageDisplay){
let state = {
title: "title",
url: window.location.href,
};
window.history.pushState(state, "title", state.url);
}
}
- Add browser listening events
popstateHandler: any;
this.popstateHandler = this.backPopstate.bind(_this);
window.addEventListener('popstate', this.popstateHandler,true)
// Browser return execution method
backPopstate(){
if(this.iframePageDisplay){
this.iframePageDisplay = false;
history.back();
window.removeEventListener('popstate', this.popstateHandler, true);
}
}
- Remove the added browser event ;
ngOnDestroy(){
window.removeEventListener('popstate', this.popstateHandler, true);
}
边栏推荐
- 994. 腐烂的橘子-非递归法
- [saison de remise des diplômes · technologie agressive er] votre choix, agenouillez - vous et partez
- MySQL重做日志 redo log
- Too much if logic in JS, common optimization
- 897. 递增顺序搜索树
- Mongodb record
- 301. 删除无效的括号
- MySQL optimization
- [STL] unordered of associated container_ Map Usage Summary
- Why can't the index of JS array use negative numbers
猜你喜欢

MySQL optimization

XML schema record

网页制作存在的一些难点

Open source oauth2 framework for SSO single sign on

redux Actions may not have an undefined “type“ property. Have you misspelled a constant?

idea自动生成serialVersionUID

Common setup modes (Abstract Factory & responsibility chain mode & observer mode)
![[project training] multi segment line expanded to parallel line](/img/f2/ee4985fd2454bf00d600e34a818f2d.png)
[project training] multi segment line expanded to parallel line

RFID数据安全性实验:C#可视化实现奇偶校验、CRC冗余校验、海明码校验

Eureka
随机推荐
Add IPAD control function into shairplay
【STL】pair用法总结
关于#sql#的问题:有没有不增加字段,在原有字段的基础上,对字段里面的null值进行填充的方法呢
使用ts-node直接运行TypeScript代码
English grammar_ Adverb - ever / once
TP6+Redis+think-queue+Supervisor实现进程常驻消息队列/job任务
Linux安装mysql8.0.25
cetos7 记录
小白投资理财必看:图解基金买入与卖出规则
反鸡汤致辞
Common setup modes (Abstract Factory & responsibility chain mode & observer mode)
【毕业季·进击的技术er】自己的选择,跪着也要走
What you need to know about five insurances and one fund
云原生落地进入深水区,博云容器云产品族释放四大价值
WPF command directive and inotifypropertychanged
Eureka
core.js是什么---kalrry
[shell] tree command
What are the pension financial products in 2022? Low risk
C # how to obtain DPI and real resolution (can solve the problem that has been 96)