Common Issues¶
Requests being blocked by CORs¶
If Fetch/XHR requests from your website to the lite api are being blocked by CORs, then your domain(s) probably haven't been added to your site. To do this follow the instructions here.
Identifying first load¶
One of the most common issues is identifying when the embed has or hasn't loaded. This can be used to either display your own loading indicators, or to keep the embed hidden in case it cannot be loaded for some reason.
To identify the first load simply wait for the first page-load event to be fired by the eventHandler, if the embed cannot be loaded then this event will never be fired, otherwise it will be the first meaningful event (there may be other events fired before).
Here is an example of how this can be implemented:
<script src="https://lite.speccheck.com/js/plugin-ko-p.js"></script>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function () {
const container = document.getElementById("jsEmbed");
new SpecCheckLite({
knockout: ko,
container,
// ... embed specific configuration
eventHandler: function (e) {
if (e.event == "page-load" && container.classList.contains("hidden")) {
container.classList.remove("hidden");
}
},
}).create();
});
</script>
<style>
.hidden {
display: none;
}
</style>
<div id="jsEmbed" class="hidden"></div>
In this example the embed will be loaded into the jsEmbed div element, which is hidden by the hidden css class. Once the embed fires it's first page-load event then the hidden class is removed from the jsEmbed element, showing the loaded embed.
Further Assistance¶
If you have any questions at all then please contact our support team by emailing [email protected]