English
Appearance
English
Appearance
.CSN_k2nM.gif)

.CuDomM1N.png)
Contact Us
WARNING
Pages that embed the plugin using an iframe (your custom H5 page) must run over HTTPS, or be accessed via http://localhost.
Otherwise, the iframe will not be able to access the device camera, and you may see errors such as “Supported only on iOS 11 or above.”
We do not recommend testing in a local development environment using LAN IPs such as 192.168.x.x, 172.16.x.x, or 10.x.x.x, unless you know how to properly configure HTTPS and ensure mobile devices can access it.
For reliable testing, we recommend deploying to an online environment with HTTPS enabled.
<script type="text/javascript" src="https://www.kivicube.com/lib/iframe-plugin.js"></script><style type="text/css">
iframe#kivicubeScene,
iframe#kivicubeCollection {
/* Set width and height as needed */
width: 100vw;
height: calc(100vw * (4 / 3));
/* Remove the browser’s default iframe border */
border: none;
}
</style>
<!-- Embed a Scene -->
<iframe id="kivicubeScene" scene-id="n5KxG0svcgNyZof1aWz2kGl6oHNh2JRl"></iframe>
<!-- Embed a Collection -->
<iframe id="kivicubeCollection" collection-id="b46rfc"></iframe>When you add an iframe with the ID kivicubeScene and specify a scene-id attribute, the imported library will automatically open the corresponding Scene (as shown in the code example above).
If the iframe does not use the ID kivicubeScene, or if no scene-id attribute is provided, the developer must manually open the Scene using the API.
// The global variable `kivicubeIframePlugin` is provided by the imported Kivicube library.
kivicubeIframePlugin.openKivicubeScene(document.querySelector("iframe"), {
sceneId: "rDM7kXvo1UJKHnQUR46s7neoCSutDul9",
hideLogo: true, // Whether to hide the homepage logo. Default: false
hideTitle: false, // Whether to hide the homepage title. Default: false
hideDownload: false, // Whether to hide the download progress bar. Default: false
cameraPosition: "back",// Camera direction: front or back. Default: back
hideLoading: true, // Whether to hide the loading indicator. Default: false
hideScan: false, // Whether to hide the scan UI and instructional text. Default: false
hideTakePhoto: false, // Whether to hide the photo button. Default: false
hideBackground: true, // Whether to hide the scene background. Default: false (only for Web 3D scenes)
});You can close a Scene by directly removing the iframe element (removing it from the DOM and clearing all references), or by changing its src to another URL, or setting it to "about:blank".
Any of these approaches will close the Scene.
However, regardless of which method you choose, you must also call the API to notify the Kivicube library that the Scene has been closed; otherwise, memory leaks may occur.
const iframe = document.querySelector("iframe");
// Method 1: Clear the iframe content.
// Note: This method does NOT work in iOS WeChat. Use Method 2 instead.
iframe.src = "about:blank";
// Method 2: Load another URL, such as the official empty page:
iframe.src = "https://www.kivicube.com/lib/empty.html";
// Method 3: Remove the iframe from the DOM.
iframe.parentNode.removeChild(iframe);
// IMPORTANT: No matter which method you use, you MUST call the destroy API.
kivicubeIframePlugin.destroyKivicubeScene(iframe);sceneId
Obtain Scene ID
After creating and saving a Scene on the Kivicube platform, click the “Share” button in the top-right corner, then click “Copy Link.”
The characters that appear after the final slash in the URL are the Scene ID.
For exmaple:https://www.kivicube.com/scenes/n5KxG0svcgNyZof1aWz2kGl6oHNh2JRl, "n5KxG0svcgNyZof1aWz2kGl6oHNh2JRl" will be the scene ID
hideLogo
Controls whether the Scene logo is shown on the home page.
Default: shown.
(On desktop, the Scene logo does not exist, so this property has no effect.)
hideTitle
Controls whether the Scene title is displayed on the home page.
Default: shown.
hideDownload
Controls whether to display the download progress bar (mobile) or download percentage (desktop).
Default: shown.
cameraPosition
hideStart
Whether to forcibly hide the Start button.
If enabled, the Scene will open immediately after assets finish downloading - no user tap required.
Default: not hidden.
This behaves similarly to the “Hide Start Button” option in the Scene Editor, but the plugin will force the behavior regardless of Scene conditions.
WARNING
Note: If the Scene contains auto-play videos or audio, hiding the Start button may prevent autoplay due to browser restrictions.
hideLoading
Controls whether to show the loading indicator on AR/3D pages.
Default: shown.
In some cases, loading completes very quickly, so the indicator may barely appear.
For Image Tracking and Cloud Recognition scenes:
The scan UI appears only after scene resources finish loading.
For 3D Interactive scenes:
The 3D content appears immediately once resources are loaded.
hideScan
Controls whether to show the scan UI and instructional text in AR/3D scenes.
Default: shown.
hideTakePhoto
Controls whether to show the built-in photo capture button in AR/3D scenes.
Default: shown.
hideBackground
Controls whether to show or hide the scene background.
Default: shown.
WARNING
Only application to 3D Interactive Scenes
disableOpenUrl
Allows you to disable the plugin’s default behavior of opening webpages using location.href = url.
You can listen for the openUrl event, obtain the target URL, and handle the navigation yourself. For example:
(image missing)
load
When it triggers:
Triggered when the Kivicube Web AR plugin script finishes loading and begins opening the Scene, and the plugin has finished downloading the Kivicube page from the server.
After this event, the plugin will start retrieving the Scene data.
Essentially, this event corresponds to the iframe’s native load event.
Best practice
In some network environments, especially under poor network conditions: the plugin script and Kivicube page may take noticeable time to load.
Developers may display a custom loading indicator during this period to improve user experience.
error
When it triggers:
Error code
| Error Phrase | Error Message | Description |
|---|---|---|
| Scene Initialization | Failed to retrieve scene information! (200, 404) |
ready
When it triggers:
Scene Data Structure
sceneInfo
{
sceneId: 'sceneid',
name: 'scenename',
description: 'scenedescription',
thumbnailUrl: 'scenethumbnailURL',
mode: 'scenetype',
collectionId: 'collectionid',
collectionName: 'collectionname',
firstPage: {},
metadata: {},
setting: { skipScanMarker: false },
objects: [{
id: 'objectid',
name: 'objectname',
type: 'objecttype',
}]
}downloadAssetStart
When it triggers:
Notes:
On iOS 15+, AR video and transparent video assets are not downloaded in advance.
They use progressive streaming instead (download while playing).
downloadAssetProgress
downloadAssetEnd
When it triggers:
Notes:
On iOS 15+, AR video and transparent video assets are not downloaded in advance.
They use progressive streaming instead (download while playing).
loadSceneStart
When it triggers:
loadSceneEnd
When it triggers:
sceneStart
When it triggers:
tracked
When it triggers:
Note
lostTrack
When it triggers
Note
openUrl
When it triggers:
Triggered when a user interaction in the Scene attempts to open a webpage (e.g., tapping an object that links to a URL).
You may combine this with the disableOpenUrl property to implement custom behaviors, such as:
When you add an iframe with the ID kivicubeCollection and specify a collection-id attribute, the imported library will automatically open the corresponding Collection (as shown in the Configuring the iframe Tag section).
If the iframe does not use the ID kivicubeCollection, or if no collection-id attribute is provided, the developer must manually open the Collection using the API.
// The global variable `kivicubeIframePlugin` is provided by the imported Kivicube library.
kivicubeIframePlugin.openKivicubeCollection(document.querySelector("iframe"), {
collectionId: "cqcmzh",
hideLogo: true, // Whether to hide the homepage logo. Default: false
hideTitle: false, // Whether to hide the homepage title. Default: false
hideDownload: false, // Whether to hide the download progress bar. Default: false
cameraPosition: "back", // Camera direction: front or back. Default: back
hideStart: false, // Whether to force-hide the Start button. Default: false
hideLoading: true, // Whether to hide the loading indicator. Default: false
hideScan: false, // Whether to hide the scan UI and text. Default: false
hideTakePhoto: false, // Whether to hide the photo button. Default: false
disableOpenUrl: false, // Whether to disable the "open webpage" function. Default: false
});You can close a Collection by directly removing the iframe element (removing it from the DOM and clearing all references), or by changing its src to another URL, or setting it to "about:blank".
Any of these approaches will close the Collection.
However, regardless of which method you choose, you must still call the API to notify the Kivicube library that the Collection has been closed; otherwise, memory leaks may occur.
const iframe = document.querySelector("iframe");
// Method 1: Clear the iframe content.
// Note: This method does NOT work in iOS WeChat. Use Method 2 instead.
iframe.src = "about:blank";
// Method 2: Load another URL, such as the official empty page:
iframe.src = "https://www.kivicube.com/lib/empty.html";
// Method 3: Remove the iframe from the DOM.
iframe.parentNode.removeChild(iframe);
// IMPORTANT: Regardless of the method used, you MUST call the destroy API.
kivicubeIframePlugin.destroyKivicubeCollection(iframe);collectionId
Obtain Collection ID
In the My Collections section of the Kivicube platform, select the Collection you want, open the menu in the bottom-right corner, and copy the Collection ID.
hideLogo
Controls whether the Collection’s homepage logo is displayed.
Default: shown.
hideTitle
Controls whether the Collection’s homepage title is displayed.
Default: shown.
hideDownload
Controls whether the download progress bar is shown (on mobile).
Default: shown.
cameraPosition
hideStart
Whether to forcibly hide the Start button.
If enabled, the Collection opens automatically once resources finish downloading—no user action required.
Default: not hidden.
WARNING
If the Collection contains videos or audio that are set to autoplay, enabling this forced-hide option may prevent them from autoplaying.
hideLoading
Controls whether to show the loading indicator on AR/3D pages.
Default: shown.
In some cases, loading completes very quickly, so the indicator may barely appear.
For Image Tracking and Cloud Recognition scenes:
The scan UI appears only after scene resources finish loading.
For 3D Interactive scenes:
The 3D content appears immediately once resources are loaded.
hideScan
Controls whether to show the scan UI and instructional text in AR/3D scenes.
Default: shown.
hideTakePhoto
Controls whether to show the built-in photo capture button in AR/3D scenes.
Default: shown.
disableOpenUrl
Allows you to disable the plugin’s default behavior of opening webpages using location.href = url.
You can listen for the openUrl event, obtain the target URL, and handle the navigation yourself. For example:
(image missing)
load
When it triggers:
Triggered when the Kivicube Web AR plugin script finishes loading and begins opening the Collection, and the plugin has finished downloading the Kivicube page from the server.
After this event, the plugin will start retrieving the Collection data.
Essentially, this event corresponds to the iframe’s native load event.
Best practice
In some network environments, especially under poor network conditions: the plugin script and Kivicube page may take noticeable time to load.
Developers may display a custom loading indicator during this period to improve user experience.
error
When it triggers:
ready
When it triggers:
Collection Data
collectionInfo
{
collectionId: 'CollectionID',
name: 'CollectionName',
description: 'CollectionDescription',
thumbnailUrl: 'ThumbnailImageURL',
functionType: 'CollectionType',
firstPage: {
backgroundImageUrl: 'HomepageBackgroundImageURL',
buttonUrl: 'HomepageButtonImageURL',
HideLogoAndName: true, // Whether to hide the collection logo and name
},
sceneList: ['SceneIDs available within this collection'],
}sceneReady
This event works the same way as the Scene event
downloadAssetStart
This event works the same way as the Scene event
downloadAssetProgress
This event works the same way as the Scene event
downloadAssetEnd
This event works the same way as the Scene event
loadSceneStart
This event works the same way as the Scene event
loadSceneEnd
This event works the same way as the Scene event
sceneStart
This event works the same way as the Scene event
tracked
This event works the same way as the Scene event
lostTrack
This event works the same way as the Scene event
openUrl
This event works the same way as the Scene event
sceneDestroy
The event parameters include the ID of the Scene being closed.
When it triggers
When the user taps the Back button to return to the scan screen.
(Only triggered when the Collection is of the Cloud Recognition type.)
When another Scene of the same type within the same Collection is scanned.
In this case, the current Scene will close first, and then the new Scene will open.
https://github.com/kivisense/kivicube-web-plugin-quickstart
https://github.com/kivisense/kivicube-web-plugin-cases/tree/master/web-image2d-tracking