当前位置:网站首页>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);
}
边栏推荐
- [project training] multi segment line expanded to parallel line
- MySQL MVCC多版本并发控制
- 994. 腐烂的橘子-非递归法
- 【毕业季·进击的技术er】自己的选择,跪着也要走
- [daily training] 513 Find the value in the lower left corner of the tree
- 313. 超级丑数
- Summary of qvariant use in QT
- About professional attitude
- System permission program cannot access SD card
- MySQL Redo log Redo log
猜你喜欢

Swagger3 integrates oauth2 authentication token

C language learning summary

mysql 基础查询

ssm + ftp +ueditor

Some difficulties in making web pages

js 判断两个数组增加和减少的元素

Common setup modes (Abstract Factory & responsibility chain mode & observer mode)

聚焦行业,赋能客户 | 博云容器云产品族五大行业解决方案发布

Xxl-sso enables SSO single sign on
![[STL] summary of map usage of associated containers](/img/1d/1b6488ea47face0548500b1e1ec60d.png)
[STL] summary of map usage of associated containers
随机推荐
Some difficulties in making web pages
994. rotten oranges - non recursive method
[project training] change of linear arrow
MySQL optimization
Easy EDA learning notes 09 esp32-wroom-32e module esp32-devkitc-v4 development board one click download circuit
【项目实训10】箭头的绘制
【项目实训】线形组件的细节
[STL] summary of pair usage
回调函数详解
[project training] multi segment line expanded to parallel line
.h5文件忘记数据库名字,使用h5py打印
Influence of steam education on domestic college students
Xiaobai must see in investment and wealth management: illustrated fund buying and selling rules
[graduation season · advanced technology Er] it's my choice. I have to walk on my knees
[bull Chinese document] queue package used to process distributed jobs and messages in nodejs
301. 删除无效的括号
XXL-SSO 实现SSO单点登录
ssm + ftp +ueditor
【毕业季·进击的技术er】自己的选择,跪着也要走
Why does TCP protocol shake hands three times instead of two?