Is it possible to prevent an iframe from reloading the parent window?
The sandbox
attribute without allow-top-navigation
prevents redirection but doesn't prevent reloading.
PS: I need the sandbox to allow both allow-scripts
and allow-same-origin
.
See the findings here, it was a question asked previously. It experiments with stopping the page reload using preventDefault()
$(window).bind({
beforeunload: function(ev) {
ev.preventDefault();
},
unload: function(ev) {
ev.preventDefault();
}
});
Original Answer
Prevent refreshing / reloading a page with JavaScript
Note: This can be done using Javascript also with a bit more work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.