I don't know why IE does this but you shouldn't need to re-write the href attribute anyway - I'm assuming you attach a click event to the buttons to load content, so just return false from the click event handler and the link won't be followed - you can leave the href attribute intact.

$(".btnNavigation").click(function(){
 // all the AJAX stuff to load content into the page
 return false;
});




on 13/02/2009 11:42 Fluffica said::
Morning all,

I'm working on a large single page site at the moment. I've seen these
around before quite happily using <a href="#page"> type mark up,
leaving jQuery to control loading the content in dynamicly and so on.

However, our solution to both graceful degradation and a worry that
Google doesn't class one page websites as websites was to have <a
href="page.html" class="btnNavigation">, leaving those without
javascript enabled using a tradiaional website which went from .html
to .html. While the js would contain  $(".btnNavigation").attr
({href:"#"}); promting those with javascript to remain on index.html#,
and let jQuery load in our content into that page.

This works lovely in all browsers but internet explorer (naturally),
which sends us straight to page.html, instead of index.html#

Does anyone have any suggestions as to why Internet Explorer is
ignoring this request? Or is there a better way I should be trying to
work this?

Huge thanks in advance,
Tom.

Reply via email to