Automatic webpage TOC
from header tags
Table of Contents
a che cosa servewhat you get
Si può usare un piccolo javascript cheWith a little javascript you can
- legge la struttura dom della paginaread the DOM structure of a webpage,
- ne estrae gliget its headers
- e crea ancore e linksand create anchors and links
Ne vedete un esempio qui sopra, riferito a questa paginaAbove you can see an example, related to this (such as of every other of this website) webpage.
considerazionia brief valuation
Lo script ha il vantaggio di aggiornarsi automaticamente con qualunque cambiamento sia apportato alle pagineThis script has the advantage of automatically updating the TOC after any changes made to a webpage.
D'altra parte esso può rendere leggermente più lento il caricamento della pagina, tanto più, quanto più numerosi sono gli haeders e lunga la pagina; inoltre è un javascript e quindi opera sul lato client: per cui se il navigatore disattiva i javascript non vede più la TOCOn the other hand, it can make the page loading slightly slower; moreover, it is a javascript and therefore works on the client side: so if your visitor deactivates javascript, it no longer sees the TOC.
dove trovarlowhere you can find it
Uno script interessante lo abbiamo trovato suI.g. here: kryogenix.org.