if (location.hash){ $('a').each(function(){ if (this.href.replace(location.origin, '') == location.href.replace(location.origin, '')) { $(this).click(); return false;} }); }