How To: Add external scripts or style libraries in Embeddables
Two ways to add external scripts or style libraries toyour Embeddable
There are two recommended methods to include external JavaScript packages in your Embeddable:
Direct HTML Inclusion (Recommended): Add the script tag directly to the HTML of the page where you’re embedding your Embeddable, alongside the Embeddables embed code.
JavaScript Action Method: Load the package programmatically through an Action that triggers when the Embeddable loads.
If you choose #2, here’s sample code for inserting a <link> tag:
Copy
Ask AI
// All Actions must contain a function called output()function output() { // Add the link tag loadStylesheet("<URL>");}// Helper function to add a link tag to the head of the pagefunction loadStylesheet(href) { const link = document.createElement("link"); link.rel = "stylesheet"; link.href = href; document.head.appendChild(link);}