chore: added new script with onload (#4987)

Co-authored-by: pandeymangg <anshuman.pandey9999@gmail.com>
This commit is contained in:
victorvhs017
2025-03-24 09:12:37 -03:00
committed by GitHub
parent 306f654617
commit 010784c2b2
3 changed files with 11 additions and 10 deletions
+8 -7
View File
@@ -8,13 +8,14 @@ const HTML_TEMPLATE = `<head>
var t = document.createElement("script");
(t.type = "text/javascript"), (t.async = !0), (t.src = "http://localhost:3000/js/formbricks.umd.cjs");
var e = document.getElementsByTagName("script")[0];
e.parentNode.insertBefore(t, e),
setTimeout(function () {
formbricks.setup({
environmentId: "ENVIRONMENT_ID",
appUrl: "http://localhost:3000",
});
}, 500);
t.onload = function(){
if (window.formbricks) {
window.formbricks.setup({environmentId: "ENVIRONMENT_ID", appUrl: "http://localhost:3000"});
} else {
console.error("Formbricks library failed to load properly. The formbricks object is not available.");
}
};
e.parentNode.insertBefore(t, e);
})();
</script>
</head>