function fixLinks(){ jQuery('a').each( function() { // get the href attribute href = jQuery(this).attr('href'); // does it have a href? if (href) { // does it have an internal anchor? if (href.charAt(0) == '#') { // append window.location and write back to the href Attribute var l= window.location+""; var n = l.indexOf('#'); var l= l.substring(0, n != -1 ? n : l.length) new_href = l + href; jQuery(this).attr('href', new_href); } } } ); } window.setInterval(fixLinks,1000);