Skip to main content
Skip table of contents

Enable embedding

Iframe embedding and embedding using the viewer API are only available for ShapeDiver users with a paid subscription.

In the “Embedding” section of the model edit page, you have the ability to enable embedding for the ShapeDiver model from web browsers. It is necessary to enable embedding in the following cases:

Allow embedding

Simply check the “Allow embedding” box to enable embedding.

The domain name of the web application from which the model will be accessed must be whitelisted. Make sure you have set up domains for embedding in your account settings.

Strong authorization

When embedding is enabled (see section above), another option becomes available. It allows to specify whether or not the model should require strong authorization when it is embedded. This requirement implements a stronger authorization mechanism while embedding the model, by means of JWT (JSON web tokens).

In practice, this mechanism is handled by the iframe out-of-the-box when it is enabled. For embedding using the viewer or geometry backend API, some additional steps are required during the implementation. You can read more about this mechanism here.

At the moment, the Forma integration only works if strong authorization is not required by the model. This will be improved in the future.

Iframe embedding

In order to use the iframe feature, simply save the settings and go back to the model view page, where you will have access to the iframe options and the ability to copy the full iframe code for your website.

Direct embedding using the Viewer API

Once the box is checked, three elements are displayed in the section:

  • An embedding ticket

  • The model view URL, which indicates which backend system is hosting the model. ShapeDiver uses several geometry backend systems and it is important to specify which one hosts your model when using the viewer API.

  • As a read-only information, the domains you have whitelisted for embedding are displayed on the right.

You can copy the ticket and the model view URL and use them with the viewer API to build a custom web application. The simple example on this page clearly shows where to use both elements in order to start a session to your model.

Once you have allowed embedding for your model, make sure you have set up domains for embedding in your account settings.

The embedding ticket can only be used to open a session with the model from a web browser. In order to communicate with the model in a headless context (applications that do not run in a web browser), you will need to enable backend access and use a ticket for backend access.

Access the Geometry Backend API from a browser

In case your application is directly accessing the model using the Geometry Backend API from a browser, without using the viewer we provide, use the embedding ticket and model view URL as described above. As an example this case applies if you are using a different viewer, or if you are triggering exports directly using the Geometry Backend API or SDK from a browser.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.