I have a problem with loading JavaScript in Google Chrome.
I\'ve created the separate js file with a simple alert message and then linked it before the end of the body
Your problem is that your script have the tag async
, which let it execute whitout taking care of the web page loading state. Remove the async
tag, or replace it with defer
, which execute the script after the page loading.
In order to prevent any problem with script and html/css loading times conflict, you should encapsulate your Javascript's scripts with window.onload = function() { //code here }
. This will guarantee that your whole page is loaded before executing your code.