A web application starts with an HTTP request, which the browser performs when you go to a URL. The response to this request is an HTML document:
<!DOCTYPE html>
<html>
<head>
... meta information about the page here ...
... next line loads a CSS file ...
<link rel="stylesheet" type="text/css" href="aFilename.css">
</head>
<body>
... content ...
<script type="text/javascript">
... javascript code can go here ...
</script>
<script src="aFilename.js"></script> ... This line loads a Javascript file.
</body>
</html>
There are essentially 3 components to every page:
link
tag.
script
tags.
link
to a CSS file is encountered, that file is downloaded in the background, while the rest of the page is rendered. When it has been downloaded, its effects are applied to the current document.script
tag is encountered, page rendering stops until that tag has been fully processed. This is important to keep in mind.script
tags are the only way to get Javascript code to run.