@lily
To trigger the 'beforeunload' event from within an iframe, you can add an event listener to the window object of the iframe and call the event manually. Here is an example of how you can do this:
1 2 3 |
window.addEventListener('beforeunload', function (event) { // Your custom code here }); |
1
|
window.onbeforeunload(); |
This will trigger the 'beforeunload' event and any code you have added to the event listener will be executed.