An HTML document 1) is a well-formed HTML string (ie that contains the html root element).
As from one document with Javascript, you can show different text, a web page is a logical representation of a document
The HTML textual representation can be stored:
When the browser process this page, it will create an in-memory/code representation and the HTML page becomes a DOM document.
The URL associated with a Document is the document's address.
Elements represent things; that is, they have intrinsic meaning, also known as semantics. For example, an img element represents an image.
<!-- tells the browser what language it's reading -->
<!DOCTYPE html>
<!-- Starts the HTML document -->
<html>
<head>
<title>Sample page</title>
</head>
<body>
<h1>Sample page</h1>
<p>This is a <a href="demo.html">simple</a> sample.</p>
<!-- this is a comment -->
</body>
<!-- Ends the HTML document -->
</html>
There are always two parts to the file:
See DOM - HTML vs XML document
To display a page, a browser:
This is described in details in this page: Web - Timeline of a page load (Page Speed|Page Latency)
See Metadata
The identifier of a HTML document is its URL.
But because you may render or move a HTML page to another URL, the rel=canonical was introduced to represent an universal id (as described in RFC 6596).
And to complicate things, all metadata schema may also have their own meta where to store this information. For instance, og:url for the open graph tag
On Facebook, If you move a page to a new URL, you can use the old URL as the canonical source for the new URL, retaining likes, comments and shares for the object. Ref Ref2 - How do I move a page to a different URL?
Note that a html document can contain other document with the frame, iframe.