One css (and js) file for multiple html files (different domains)

I would like to use the same css file for multiple html files (different domains hosted by infinity free).
When I just link the full URL, the css file is not respected (only on same domain).

Any ideas or solutions?

Many thanks in advance!

That could be something called Content Security Policy (CSP); InfinityFree’s blocking system, /aes.js.

Another thing to check is if you loaded the link correctly. CSS files are loaded like so:
<link rel="stylesheet" href="<YOUR CSS FILE>" />

You could put the file on GitHub and load it per above and use


Thank you for your immediate answer, wackyblackie!

The css file already works with GitHub and jsdelivr - the js file not yet …

Thanks again!

Remember the naming scheme for jsdelivr.
Also, js files can be loaded in head or body like so:
<script src="<YOUR JS FILE/CDN.JSDELIVR.NET URL>"></script>
Do not forget the closing script tag.

Also, could you provide a URL so I can check? You can share it here or PM it to me.

I get the
Failed to fetch version info

Other users seem to experience the same problem at the beginning - so see if it works tomorrow.

Hopefully the service is reliable afterwards …

1 Like

@infinityfree_user, you can host the style.css file externally on GitLab, GitHub, Netlify and many more! Then link them to your html files across many domains. Like:

<link rel="stylesheet" href="//[your_netlify_domain]/[project_name]/[filename].css">

Alternatively, you can also inline the CSS in the HTML file between the <style></style> tags in the head tags!


Thank you both very much!

According to what I have learnt, jsdelivr seems to be very good for jquery and the like and version control. It seems to have some time lag.

In my case I prefer instant changes and I also like the fact that for netlify, GitHub commits seem to be okay - no releases needed.

Thanks again for your valuable help!

Similar question:

How do I insert the same html snippet into different html files (same and different domain)?

I don’t think you can do that with HTML, I think you need PHP.

1 Like

Thanks, Greenreader9!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.