Streaming live at 10am (PST)

Custom code limit / storing script on external server

Hi!

I’m subscribing to a service called Make Room that allows for selling prints of my artwork online. They provide a code I can use to embed their store on my website but the code exceeds the custom code character count as it is around 11000 characters.

From what I’ve gathered from old (dating back to '15) conversations on this forum, one way of solving this is storing the script on another server and then embed it as a script file. I have very little experience in anything of the sort and could use some advice. Where would be a suitable place to store the script and how do I refer to it in webflow once this is done? Would Dropbox work for this?

Open github repo

image

Create new file (.js put any you code you want)

Save

Than create CDN like this:

Or:

On webflow:
copy paste the script before body/head.

<script src="{{your github url here }}"></script>

Hi!

Thanks for a quick reply!

I followed the tutorial but it doesn’t seem to work. On rawgit.com it says the service is no longer available. Is that why or did I do something else wrong?

The js file adress is:
https://raw.githubusercontent.com/VilleSalervo/MakeRoom/main/MyMakeRoom.js

As instructed, I changed it to:
https://cdn.rawgit.com/VilleSalervo/MakeRoom/main/MyMakeRoom.js

Here’s my project link if you’d like to take a look, the HTML Embed is on the “Shop” page below “Posters” headline.

https://preview.webflow.com/preview/portfolio-5621b6?utm_medium=preview_link&utm_source=designer&utm_content=portfolio-5621b6&preview=93c12282b53ae30ffceec57e336b84eb&pageId=615dc1dc701d80bbba2b8c17&workflow=preview

@Ville_Salervo1 - Use jsDelivr to host your Github assets. It is almost a drop-in replacement for rawgit. See Features - jsDelivr

Note; You can’t include script tags or plain HTML in your JavaScript.

Thank you! Tried that but unfortunately I still can’t make it work. The problem’s probably in the script itself or how I’ve named it. You mention it can’t include script tags or plain HTML. Should I strip something off of it? Sorry if this is a stupid question, but I’m quite illiterate when it comes to coding or HTML and I’m not sure if I’d spot those tags if they’re there.

Here’s the .js script link again:
https://raw.githubusercontent.com/VilleSalervo/MakeRoom/main/MyMakeRoom.js

Try removing the first three lines of the code, so it starts with the

function()

And the at the end remove the final closing

</script>

Then you have a JavaScript file containing only JavaScript. The other bits were HTML.

The embed code should be something like this


<script src="link-to-your-script.js"></script>

Steve