Skip to main content
All CollectionsSolve an issue
How to load/unload widget with Web App
How to load/unload widget with Web App
Clara Hachem avatar
Written by Clara Hachem
Updated over 2 months ago

When using widget in a web application (SPA, SSR, SSG, etc.), the loading or unloading of the widget may not be performed correctly.

To address this issue, a set of data and methods are provided, injected into the browser's window object, allowing the developer to interact with the widget.

How to proceed :

In the window object, window.joinStories.widgets[alias] is available with the following elements:

  • loaded → shows the widget's current state

  • load → method to load the widget

  • unload → method to unload the widget

→ Call window.joinStories.widgets[alias].unload() to remove a widget.

→ Call window.joinStories.widgets[alias].load() to display a widget.

→ Call window.joinStories.widgets[alias].load(true) to force the widget to re-display.

Did this answer your question?