Advanced Usage : Self-Hosting the Web SDK
For enhanced control over caching, distribution, and availability, you can self-host the IDWise WebSDK. This involves downloading the necessary files and serving them from your own infrastructure instead of relying on the IDWise CDN.
Prerequisites: Required Files
You need to download the following two files from the official release location and place them on your server.
| File Type | File Name | CDN URL |
|---|---|---|
| JavaScript | idwise.min.js | https://releases.idwise.com/websdk/latest/idwise.min.js |
| CSS | idwise.min.css | https://releases.idwise.com/websdk/latest/idwise.min.css |
Implementation: Initialization with stylesheetUrl
When self-hosting, the CSS file is not automatically injected. You must explicitly provide the complete, publicly accessible URL of the hosted idwise.min.css file during the initialization process.
This is achieved using the new configuration parameter
stylesheetUrl: A string contains the absolute URL where the self-hosted idwise.min.css file can be accessed by the client browser.
Example Initialization
Replace https://yourdomain.com/assets/idwise.min.css with the actual path on your server.
<script>
let idwise;
IDWise.initialize({
//replace xxxx with client key that you have generated from API Keys section in admin panel
clientKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
locale: "en",
theme: "system_default", // Optional: Can be 'light', 'dark', or 'system_default' (default).
// Provide the absolute URL for the self-hosted CSS file
stylesheeetUrl:"https://yourdomain.com/assets/idwise.min.css"
})
.then(result => {
idwise = result
})
.catch(error => {
alert(error);
});
</script>
Updated 32 minutes ago
