Load JavaScript on a Web Page

Updated on

Unless you have some reason not to, the best way to load JavaScript on a web page is to use the type="module" attribute (see Load JavaScript Modules on a Web Page).

The script must be a module for that to work.

Further reading