HTML Components with local js file

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=""></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 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.

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.