tazza di caffé

Automatic webpage TOC

from header tags

icona per espandere il menu interno
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.

📂 In questa sezioneIn this section

  • List and link files, in a folder (and subfolders): come creare un elenco automaticamente aggiornabile dei files php in una cartella di un sito webhow to get a list of linked files in a given website folder
  • Automatic webpage TOC, from header tags: it is possibile to get an automatic index (TOC, table of contents) of a webpage
  • Redirect by language, in a multilingual website: come reindirizzare i visitatori in base alla loro linguaredirect website visitors according to their language