在父页面中加入js监听F5刷新操作
$("body").bind("keydown", function (event) {
if (event.keyCode == 116) {
event.preventDefault(); //阻止默认刷新
$("#mainFrame").attr("src", window.frames["mainFrame"].src);
}
})
在子页面中加入js监听当前页面的F5刷新操作,可以写到公共的js中,可以不用再每个子页面中添加js
$("body").bind("keydown", function (event) {
if (event.keyCode == 116) {
event.preventDefault(); //阻止默认刷新
location = location;
}
})
文章来源于:https://blog.csdn.net/weixin_42660884/article/details/84957204