When I needed something similar, I created a frameset in main.htm
file like:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>My framed webpage</title>
</head>
<frameset cols="25%,*">
<frame src="toc.htm">
<frame src="content.htm" name="content">
</frameset>
</html>
toc.htm
- table of contents, a list of links referred to content.htm
file by id (with list of elements <a href="content.htm#toc_0" target="content">Link Title Name</a>
with ids toc_0
... toc_n
). Right frame in result file.
content.htm
- content file with links with ids toc_0
... toc_n
you want to refer to. They might be any h*
elements. Left frame in result file.
If you use Java, then Jsoup is your best friend.
<frameset>
tag is deprecated HTML tag The tag is not supported in HTML5
UPD. When you have three files main.htm
, toc.htm
and content.htm
just open a main one. Previously there was a flag in Chrome experimental features to save as a MHTL and you had only to activate it, but now seems they have removed it.
However you can use a Save as MHTML add-on instead.