My HubSpot app uses the calling sdk demo to link calls to another program. As such, the widget only forwards the user, and serves no other purpose afterwards.
An issue I’m having is that, when the widget is left opened and the user leaves/reloads the site, a warning popup will show up about unsaved changes being lost, which would wouldn’t matter for my widget. As such, I’d rather not have the popup for a better user experience.
Is there any way to prevent this popup from occuring?
I assume it to be caused by the onbeforeunload event, but I cannot overrride/disable it from within the iframe’s code it seems.
My HubSpot app uses the calling sdk demo to link calls to another program. As such, the widget only forwards the user, and serves no other purpose afterwards.
An issue I’m having is that, when the widget is left opened and the user leaves/reloads the site, a warning popup will show up about unsaved changes being lost, which would wouldn’t matter for my widget. As such, I’d rather not have the popup for a better user experience.
Is there any way to prevent this popup from occuring?
I assume it to be caused by the onbeforeunload event, but I cannot overrride/disable it from within the iframe’s code it seems.
Since your widget doesn’t involve saving any changes, you want to prevent this dialog for a smoother user experience. Unfortunately, directly overriding or disabling this event within the iframe’s code isn’t feasible due to browser security measures.
However, you can explore alternative approaches. One option is to communicate with the parent page if your widget is embedded within an iframe, instructing it not to trigger the onbeforeunload event when your widget is active. Another approach is to utilize the unload event instead, which doesn’t prompt the user with a dialog.
You can handle any necessary cleanup or navigation logic within this event handler. However, be cautious about overriding browser behaviors and thoroughly test any changes to ensure they don’t create unexpected issues for your users.