# Sharing

## Events

### `onShare`

This subscription will trigger whenever a user clicks the share icon.

{% hint style="warning" %}
**Note:**

Once you attach your listener to the "onShare" event, iPaper's native share functionality (copying the URL to clipboard on click) will be disabled. You will have to handle sharing using your own logic.

You can revert back to using iPaper's native sharing by simply [unsubscribing ](/flipbook-javascript-api/commands-and-events.md#an-introduction-to-commands-and-events)from the "onShare" event.
{% endhint %}

```javascript
instance.share.onShare((sharePayload) => {
    // YOUR CODE HERE
});
```

The share payload contains all properties that can be used to link back to the Flipbook and open it on the page where the share event was invoked:

| Property  | Type     | Description                                                        |
| --------- | -------- | ------------------------------------------------------------------ |
| `baseUrl` | `string` | The base URL of the shared Flipbook                                |
| `url`     | `string` | The full URL of the shared Flipbook which includes the page number |
| `page`    | `number` | The number of the page where the share event was triggered         |


---

# 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.ipaper.io/flipbook-javascript-api/commands-and-events/sharing.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.
