Quick Start
The v2 Flipbook JavaScript API allows for streamlined interaction with iframed flipbooks using cross-origin communications available in modern browsers.
Last updated
The v2 Flipbook JavaScript API allows for streamlined interaction with iframed flipbooks using cross-origin communications available in modern browsers.
Last updated
The v2 Flipbook JavaScript API uses the for two-way communications between the parent window and one or more flipbooks embedded in the parent window inside <iframe>
elements.
For this to work, you will need to include the API script on your page. on how to obtain the iPaper Flipbook JavaScript API script from the admin. The generated code will look something as follow:
Most of our customers use our API to interact with a single instance of a flipbook on their page. A frictionless, minimal config setup is therefore implemented—meaning that for use-cases involving single flipbooks iframed on a single page, no additional configuation or markup changes are required. While the setup will automatically attempt to identify the first iframed flipbook on the page, we do still reccommend adding the data-ipaper
attribute to the iframe to ensure the most reliable detection:
The embedded script will call the iPaperInit()
method that is defined globally in the parent window, and you can then interact with the iframed flipbook via the iPaperAPI
instance created by default:
As an alternative to using the iPaperInit
function like in the snippet above, you can also use an event listener for iPaperInit
instead:
Note: If you are using multiple flipbooks, additional configuration is required: please refer to the section for further information.
The iPaperAPI
object exposes several methods that can be grouped into two categories: and .
Events happen on the flipbook and are emitted to the parent window, which trigger magic callbacks. An example of a flipbook event is the event. about how to listen to these events and react to them accordingly.
Commands are instructions issued from the parent window to the flipbook, done via invoking magic commands. An example of a flipbook command is the method. about how to issue commands to instruct your iframed flipbook to perform specified actions.
In the event that multiple flipbooks are to be embedded via <iframe>
on the same page, some additional configuration is required. Refer to the section for further implementation details.