HTML Components with local js file

Hi,
I’m trying to make use the HTML component function using a local java script file, but I can’t get it to work. Here is an example, using the github gist component example:

Using it with a remote js file works:
components.html('<script src="https://gist.github.com/tc87/9382eafdb6eebde0bca0c33080d54b58.js"></script>', height = 250)

But when I download the .js file and try to access it, it just doesn’t give me any output
components.html('<script src="github_gist.js"></script>', height = 250)
And the file is in the same folder as my streamlit.py file. Giving it the full path also did not work.

I’m sure I’m missing something obvious, but I just can figure it out.
Thanks,
Christoph

You need a server to serve such files especially if they have files included via nested web requests.

Try using components.iframe instead. This post may help.

If your app includes a custom component, then you can use its web server to serve your file from the frontend/public web server folder. See this post for an example.