简体   繁体   中英

JS files not found (404)

I'm running the application locally and it works fine. When I uploaded it to my hosting account I started getting 404 errors on JS

It's happening in both Chrome and Firefox.

Chrome Inspect Element Errors

The directory structure

The files are located in the designated location and the code is at the bottom of the page so they shouldn't be getting accessed before they're loaded.

 <script src="libs/bootstrap-switch-master/docs/js/jquery.min.js"></script> <script src="libs/bootstrap-toggle-master/js/bootstrap-toggle.min.js"></script> <script src="libs/angular/angular.js"></script> <script src="libs/angular/angular.min.js"></script> <script src="libs/angular-auto-validate/dist/jcs-auto-validate.min.js" ></script> <script src="libs/ladda/dist/spin.min.js" ></script> <script src="libs/ladda/dist/ladda.min.js" ></script> <script src="libs/angular-ladda/dist/angular-ladda.min.js"></script> <script src="libs/clipboard.js-master/dist/clipboard.min.js"></script> <script src="libs/jquery-color-master/jquery.color.js"></script> <script src="main.js" ></script> </body > </html > 

In Chrome Developer Tools (F12 in Google Chrome), if you go to the sources tab you can see the content (css and js) that is on the page. It appears that some of your files are missing and some of the directories are incorrect.

It looks like with some of the content you assumed that support-wizard was the root directory when it isn't.

For example, some of your sources should be:

/support-wizard/libs/ladda/dist/spin.min.js
/support-wizard/libs/ladda/dist/ladda.min.js
/support-wizard/libs/bootstrap-toggle-master/css/bootstrap-toggle.min.css

在此处输入图片说明

If you try going to each page it should load (ie: ztsales.com/support-wizard/libs/ladda/dist/ladda.min.js)

Solved.

It was a permissions issue. The PATHs were right but the problematic directories and files didn't have execute permissions.

EDIT(zpert): Make sure directory permissions are 755, which means:

  • Owner: Read, Write, Execute
  • Group: Read, Execute
  • Public: Read, Execute

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM