how to capture a widget before unload

361
1
09-09-2019 12:09 PM
WorkPlaece
New Contributor

Opening a web map in an iframe.

The web map app has multiple widgets on it.

Need to capture the event just before one of the widget unloads when user closes the window containing the iframe.  Need to capture and handle for this from "within" the widget code to access various widget variables and functions.

Is there a built in event for this?

Tags (1)
0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus

This is something you would have to do catch at a much higher level then the widget code. When the app that holds the widget is closed you will not get to see code inside the widget react to the app being closed. In the main app that creates the iframe you will have to catch the close event.

iframe[0].contentWindow.onbeforeunload = function () {
 ...
}

Still not sure how you would get access to the widgets properties though.

0 Kudos