CDN viewer¶
Open the example · JavaScript source
This is the basic viewer with the SDK and engine served by sdk.maverickexcelsior.com. Your site still hosts its own HTML, application code, and .webex scenes.
<script src="https://sdk.maverickexcelsior.com/webex-viewer-opengl/v2.0.0/webex-viewer.js"></script>
<script src="./js/app.js"></script>
The SDK locates the matching engine JavaScript, WASM, and data files beside itself. Pin an immutable release tag and load every runtime file from that same tag. Never use latest and never combine files from different releases.
Application code is otherwise identical to a self-hosted integration. app.js is a classic script here, so it cannot use a top-level await:
WebexViewer.mount({
container: '#viewer',
apiKey: 'ak_xxxxxxxxxxxxxxxx',
scene: new URL('./scenes/scene.webex', location.href).href
}).then(viewer => {
// The viewer is mounted and its scene is ready.
}).catch(error => {
console.error(error);
});
Use self-hosting when your security policy disallows third-party scripts or you need full control over caching. Use the CDN for the shortest initial setup.
