Importing the site navigation

I added a new page about importing the site navigation on all pages. The page is mostly about why I do what I do, and less about the how (besides, technically it's quite easy). The site navigation is a perfect example of what Jeremy calls Hijax.

I also put my trusty XMLHttpRequest functions online for future reference. No explanations on this page; I already treated them in section 10A of the book.

This is the blog of Peter-Paul Koch, web developer, consultant, and trainer. You can also follow him on Twitter or Mastodon.
Atom RSS




Comments are closed.

1 Posted by Devon on 6 February 2007 | Permalink

Neat trick. I just don't like that it needlessly breaks the navigation when it's done this way.

2 Posted by Tino Zijdel on 7 February 2007 | Permalink

Personally I don't think I would have taken the approach of putting that complete document into a non-appended element and traversing it's nodes. I think I would have taken a shortcut by just using indexOf to determine the positions of '<div id="mainMenu">' and '</div><!-- mainMenu -->'. These are unique in the document, and since you have full control of it it seems a logical thing to do and will probably be a lot faster.

Ofcourse making your sitemap page a dynamic page that can be 'told' to output only the necessary part would actually make even more sense; you have the means to use serverside scripts, why not use it?

3 Posted by Greg Reimer on 8 February 2007 | Permalink

Fascinating. Do you suppose this could/would impact SEO or how Google treats your site? If you notice anything along those lines, it would be interesting to hear it.

4 Posted by Cory Duncan on 23 February 2007 | Permalink

Excellent execution on the Hijax script, but I do wonder this: How does hiding your site navigation by default benefit the user experience?