I want to download a script from cdn and use it

I wanted to download a script and use it instead of using cdn

The cdn links are

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/object-assign-auto.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/encoding.min.js"></script>

Instead I downloaded and tried to use

<script src="./js/encoding.js"></script>
  <script src="./js/object-assign-auto.js"></script>

But it doesnt work it shows

NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier).

I think I am not using the downloaded files in the right way. suggestions please, thank you



Add thr scripts to the angular.json file, in the scripts sections.

Paths starts at the root of your folder, so it should be js/encoding.js :

    "build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
        "assets": [...],
        "styles": [...],
        "scripts": [

Probably you don't have the scripts in the right place or the relative path "./js" is not the correct.


Since you have tagged angular in your post, you must not include scripts inside the template html. You could include them in the index.html to load them directly from cdn or download and include them inside the scripts array of angular-cli.json

If you are not using angular, the problem could be an incorrect filename, incorrect folder or even wrong relative path.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.