Files

35 lines
965 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Local Site — Subdir Page</title>
<link rel="stylesheet" href="../assets/site.css">
</head>
<body>
<header>
<h1>Subdir Page</h1>
<nav>
<a href="../index.html">Home (../)</a>
<a href="../about.html">About (../)</a>
<a href="deep/deeper/deepest.html">Deepest (relative)</a>
</nav>
</header>
<main>
<p>This page lives in <code>subdir/</code>. Stylesheet and links use
<code>../</code> to reach the root.</p>
<h2>Image via parent-relative path</h2>
<img src="../assets/pic.svg" alt="pic via ../" width="200">
<h2>fetch() a sibling JSON in this subdir</h2>
<pre id="out">not started.</pre>
</main>
<script>
fetch('sub.json')
.then(function (r) { return r.text(); })
.then(function (t) { document.getElementById('out').textContent = t; })
.catch(function (e) { document.getElementById('out').textContent = 'ERROR: ' + e.message; });
</script>
</body>
</html>