Skip Navigation

Integrate the online viewer in a web page

Follow these instructions to display a document in the web browser.
  1. Create an iframe element with a <src> value that points to where the online viewer is hosted:
    {domain}/mobile/v
    .
  2. Attach an event listner to the window, waiting for a
    message event
    .
    The first
    message
    event the web app receives contains the
    VIEWER:READY
    ID, which means that the online viewer has finished loading and is now waiting for the containing web app to send all the relevant values via a
    PARENT:INIT
    postMessage.
  3. For files in a workspace, define the message with the following values:
    • accessToken: string
    • simpleShare: boolean
    • documentGuid: string
  4. For files in an external repository, define the message with the following values:
    • accessToken: string
    • simpleShare: boolean
    • transient: boolean
    • documentPath: string
    • workspaceGuid: string
    The document will be displayed once the online viewer receives the message.
  5. Optional: Define that the parent page send a new access token to the online viewer ifram using the
    PARENT:SET_ACCESS_TOKEN
    message:
    { "id": "PARENT:SET_ACCESS_TOKEN", "context": { "accessToken": "new_access_token" } }
  6. Optional: Define that the online viewer iframe inform the parent about various actions and state changes in the online viewer:
    • VIEWER:INVALID_ACCESS_TOKEN
    • VIEWER:DOCUMENT_NOT_FOUND
    • VIEWER:NO_PERMISSION_FOR_RECIPIENT
    • VIEWER:REQUEST_EXTENSION (context: { expired: boolean })
    • VIEWER:PRINT_PERMISSION_REQUEST (context: { name: string })
    • VIEWER:CONVERSSION_TIMEOUT
    • VIEWER:CONVERSION_FAILED
    • VIEWER:MAX_SIZE_EXCEEDED
    • VIEWER:UNEXPECTED_ERROR