How to use a JavaScript library

Hello. I couldn’t find any information on how to use various JavaScript libraries in the 8thwall studio documentation, but is there a way to use them? If it’s possible, could you also let me know if there are any restrictions, such as not being able to use a CDN?

You can create a Custom Component that loads in a script from a CDN.

@GeorgeButler

With the code you shared, when I tried to load the Tone.js library, the following error appeared and it seems like it can’t be used. Is it difficult to use Tone.js in 8thwall studio?

SecurityError: Failed to read a named property ‘constructor’ from ‘Window’: Blocked a frame with origin "url” from accessing a cross-origin frame.

at Object.trigger runtime.js

at HTMLScriptElement.<anonymous> [cdnComponent.ts:30:19](https://www.8thwall.com/shintaroyamakawa/pom-dev/studio?file=cdnComponent.ts#L30C19)

Can you share the code you’re using so I can take a look?