2.20.14. JavaScript is not working or images are not displayed
When working on hosting, it should be borne in mind that the Windows operating system does not distinguish between uppercase and lowercase letters in files, in contrast to operating systems of the Linux family, which is installed on the server. In this regard, you should take into account that if you are in HTML specify the name of the image as Background.jpg
, and the file in reality will be called background.jpg
then it will be displayed on the local Windows machine, but not on Linux.
To avoid this, we do not recommend using in file names:
- Capital letters.
- Spaces and special characters.
- Cyrillic symbols.
Also for debugging and troubleshooting, you can use the developer tools in the browser (usually opened by clicking F12) Is a very powerful tool that no professional webmaster can work without. We highly recommend to study it for everyone who is engaged in the creation of sites.
To troubleshoot incorrect loading of images, styles, JavaScript and other files, we recommend that you follow the steps similar to these:
- Open the page of the site that is experiencing problems in your browser.
- Open developer tools by clicking F12 or combination Ctrl+Shift+I.
- In the window that appears, switch to the tab "Network" ("Network"):
- Refresh the open page (for example, with Ctrl+F5).
- After reloading the page, a report will be displayed in the developer tools, in which you can easily find page elements that are not loading:
- By hovering the mouse cursor over the item that returned a 404 response when requested, you can see the full path to the file on the server:
- Opening the resulting path to FTP and we see that the file
sample-1.jpg
arecalledSample-1.jpg
and because of this they are not loaded. Rename a file fromSample-1.jpg
insample-1.jpg
solves the problem.