Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular router doesn't trigger onbeforeunload in IFrame

Tags:

angular

I have an IFrame inside an angular route view. When I trigger a state change in the router via navigateByUrl the window.onbeforeunload function inside the IFrame ins't triggered. Same for addEventListern("beforunload",...).

First question: Why isn't it triggered?

Second: Is there a way to solve this easily?

like image 342
Franz Avatar asked Nov 20 '25 19:11

Franz


1 Answers

Fixed it by using the onpagehide event.

like image 136
Franz Avatar answered Nov 23 '25 10:11

Franz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!