What's the best way to add javascript scripts to a page?

Hi,
I have been successfully adding javascript scripts inside my application’s meta header, but this way all of my pages load all scripts.
Is there a way to be able to load scripts in single pages or, even better, inside the header of each page?

Thank you in advance.

Yes, you can add page-specific headers in the property editor for each page.

2 Likes

That’s great, I should have looked at page properties. Thank you very much for the help.

@adamhholmes is correct in that – in a paid app – this is the correct way to load scripts in some specific page. However, in some app tiers, control of the page HTML Header is not available (and so scripts cannot be loaded in this way).

What then? I have a plugin for that:

LOADERR can be used to add JS libraries to any page with only a tiny performance penalty over the native Bubble loading. (Basically, once the page is loaded, LOADERR appends the script(s) in question to the page.)

It can be useful for other things as well (such as inspecting what scripts are loaded in a page, which can be useful to know if you’re using crappy plugins of god-knows-what origin and experiencing issues).

You might also use it to inject a script into a page programmatically when needed. Personally, I just made it so that I could make demo pages for certain things inside of free-tier apps.

The LOADERR plugin thread with a breezy video overview/docs can be found here: LOADERR: Load JavaScript Libraries Plugin | Bubble.

LOADERR is Karma-Ware: Support awesome Bubble plugins here — GRUPZ: Karma-Ware Plugins for Bubble

3 Likes