If I have two separate HTML files named footer.html and main.html. The footer file includes a link to the top of a page like this:
<!-- footer.html -->
<!doctype html>
<html lang="en">
<head></head>
<body>
<footer>
<small><a href="_parent#header">To top</a></small>
</footer>
</body>
</html>
The main.html file is set up to include the footer using the <object>
tag (refer to note 1). There could be multiple files similar to main.html, so using <a href="page#header">
may not work.
<!-- main.html -->
<!doctype html>
<html lang="en">
<head></head>
<body>
<div id="header">...</div>
<div id="content"> Long content ... </div>
<object id="footer" type="text/html" data="footer.html"></object>
</body>
</html>
Question: Is there a way to reference the anchor from the footer in the main file without relying on javascript, php, etc?
Note 1: Using the <object>
tag allows for embedding another HTML document without creating a direct relationship between them:
You can also use the
<object>
tag to embed another webpage into your HTML document. source: http://www.w3schools.com/tags/tag_object.asp
A similar approach can be taken with <iframe>
or <embed>
instead of <object>
, but the challenge remains.