Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

RoughLik's avatar

How can I host a javascript cdn file

Hi, this is a general question about hosting a javascript file like a jQuery for example on a cdn. What could I upload this file to and how can I make a dynamic link for each user? Is it possible to host a javascript file on a cdn and import it everywhere? What would you recommend to me and how could I do that

Example like this

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
0 likes
2 replies
Snapey's avatar

your browser does not know its a CDN -it's just told to get the file from a url

Copy the file where you like and set the url appropriately.

dennisprudlo's avatar

There are services like Amazon CloudFront or Digital Ocean Spaces that offer S3-compatible storage for CDN usage. You can then upload anything you want and retrieve a url.

Please or to participate in this conversation.