# Advanced Workflows

## Single Page Applications

Single page applications dynamically add and remove DOM elements on a single webpage. To provide solution for the dynamic nature of the applications, the player has APIs to close the player when elements are removed, and to reload the player into new DOM elements:

```typescript
player.setup();
player.close();
player.reset();
player.setupWidget();
player.loadWidget();
player.destroyWidget();
```

{% hint style="info" %}
While multiple players can be setup on a single page. The Widget can be loaded only to a single player at a time. The widget is managed by a [WidgetService](https://annoto.github.io/player/classes/scripts_widget_service.WidgetService.html) singleton, each time one of the players calls `loadWidget()`, the widget is loaded in that player.
{% endhint %}

For more details please refer to the [Player API](https://annoto.github.io/player/classes/Player.AnnotoPlayer.html).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.annoto.net/developers/player/advanced-workflows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
