English
Appearance
English
Appearance
This page describes the global plugin interfaces called directly from the host page.
After you include:
<script src="https://www.kivicube.com/lib/iframe-plugin.js"></script>the host page can use the global object directly:
window.kivicubeIframePluginA typical call looks like:
kivicubeIframePlugin.openKivicubeScene(...)openKivicubeScene(
iframe: HTMLIFrameElement,
props?: SceneOpenProps,
modifyIframe?: boolean,
): Promise<{
id: string;
allow: string;
src: string;
}>iframe The iframe DOM element that hosts Kivicube content.
props Scene opening parameters. See SceneOpenProps below.
modifyIframe Whether to immediately write the generated id, allow, and src back to the iframe.
truefalse, the method only returns the computed result and does not modify the DOM, which is useful for Vue / React wrappersinterface OpenResult {
id: string;
allow: string;
src: string;
}destroyKivicubeScene(iframe: HTMLIFrameElement): voidThis cleans up the internal resources associated with the current iframe. It is commonly used together with switching iframe.src to a blank page.
Important: if you switch between multiple scenes on the same page, always call destroyKivicubeScene() when closing the previous scene.
openKivicubeCollection(
iframe: HTMLIFrameElement,
props?: CollectionOpenProps,
modifyIframe?: boolean,
): Promise<{
id: string;
allow: string;
src: string;
}>This is essentially the same as openKivicubeScene(), except that props uses the collection version.
destroyKivicubeCollection(iframe: HTMLIFrameElement): voidinterface SceneOpenProps {
sceneId: string;
hideLogo?: boolean;
hideTitle?: boolean;
hideDownload?: boolean;
cameraPosition?: 'front' | 'back';
hideLoading?: boolean;
hideScan?: boolean;
hideTakePhoto?: boolean;
hideBackground?: boolean;
hideStart?: boolean;
disableOpenUrl?: boolean;
}interface CollectionOpenProps {
collectionId: string;
hideLogo?: boolean;
hideTitle?: boolean;
hideDownload?: boolean;
cameraPosition?: 'front' | 'back';
hideLoading?: boolean;
hideScan?: boolean;
hideBackToScan?: boolean;
hideTakePhoto?: boolean;
hideStart?: boolean;
hideGyroscopePermission?: boolean;
disableOpenUrl?: boolean;
}The plugin reads supported attributes from the iframe and accepts all of the following:
hide-logohideLogodata-hide-logoWhen you call openKivicubeScene() or openKivicubeCollection(), the JavaScript props object overrides same-name attributes that already exist in HTML.
If the page contains:
<iframe id="kivicubeScene" scene-id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"></iframe>and the element already exists before DOMContentLoaded, the plugin automatically calls openKivicubeScene().
If the page contains:
<iframe id="kivicubeCollection" collection-id="xxxxxx"></iframe>the plugin automatically calls openKivicubeCollection().
allow Permissions The plugin automatically writes the required permission string:
xr-spatial-tracking;camera;microphone;autoplay;fullscreen;gyroscope;accelerometer