-1

I'm trying to find how where and how to upload my scripts where I can source them as an external script.

I can't seem to find any question like this or maybe I'm not good enough in searching

But anyway, my situation is, I need to upload script online, a basic document.write to save space.

It cannot be a file on the same folder of storage as my pages because it's for work, and pages should be shareable to people as a standalone file so they don't have to extract it anymore.

Now I have tried to upload it online on different types of cloud or host, but I can't source it, because of security purposes I think?

Or maybe the source tag I should use must be different if it's online? is it not <script type="text/javascript" src="https://abc.blabla.com/files/includes/html/page-links.js"></script>

Please please help. The main goal I have here is to upload my scripts online, and be able to source it as an external script on my "static and local website"

Thank you, Renz

The Author
  • 143
  • 5
  • Questions asking for off-site recommendations are off-topic here because they tend to attract spam. That includes web hosting recommendations. – Quentin Apr 28 '20 at 08:34
  • Hi, I'm sorry for the wrong choice of words, however, what I would like to know instead is, if it's possible to source an external script from a "dummy" website that hosts my scripts. – The Author Apr 28 '20 at 08:45

2 Answers2

0

You probably are getting into to issues in most browsers when trying to load javascript from one domain (your-website.com) to another (localhost).

https://en.wikipedia.org/wiki/Cross-origin_resource_sharing

You can try loading your browser with CORS disabled (Chrome): Disable same origin policy in Chrome

Or with a plugin such as these: https://chrome.google.com/webstore/search/cors

Fasani
  • 2,009
  • 19
  • 22
-1

You can do static hosting in firebase. once you host the files there then you can use the file link in script tag.

<script src="https://test.firebaseapp.com/file.js" ></script>
SE_net4 the downvoter
  • 21,043
  • 11
  • 69
  • 107
Vikram Hegde
  • 191
  • 1
  • 1
  • 10