To resolve this issue, split the widget initialization and handling code between the parent and child frames on your page. The parent frame is responsible for initializing the widget and handling callbacks. The child frame contains the link to launch the widget.
Here is a trial example demonstrating the mechanics of this pattern. A parent page might look like this:
And here is a child iframe that just contains the link to launch the widget: