arraysize: 0

How to retrieve the ID of the currently selected canvas

Each canvas in a IIIF manifest come with an identifier (id or @id, depending on the version of the Presentation API used). You may need it in order to be able to point to or load the canvas, but how?
First, we create a new button widget like the following. Of course, you can customise the text and appearance according to your own tastes.
<div id="iiif-canvas-notifier" data-window="mirador-window-1" >
  <button class="btn btn-outline-dark">Get canvas ID and copy to clipboard</button>
  <textarea id="iiif-canvas-text" class="form-control"></textarea>

This button lets you copy the identifier to your clipboard, as it says on the tin, as well as to the textarea directly below. Add the widget to the page with the Mirador viewer, as in this example: