Ajaxclick function will now detect if it's an external link, and if so, it won't use Ajax.

This commit is contained in:
scottjehl 2010-10-02 12:18:45 -04:00
parent 91c5b90c82
commit aeb2643bdc

View file

@ -59,13 +59,14 @@
pageTransition = jQuery( this ).attr( "data-transition" ) || "slide";
nextPageRole = jQuery( this ).attr( "data-rel" );
// let the hashchange event handler take care of everything else
location.hash = href;
// note: if it's a non-local-anchor and Ajax is not supported, go to page
if ( href.match( /^[^#]/ ) && !jQuery.support.ajax ) {
//if it's a non-local-anchor and Ajax is not supported, or if it's an external link, go to page without ajax
if ( (href.match( /^[^#]/ ) && !jQuery.support.ajax) || (href.match(/https?:\/\//) && !href.match(location.hostname)) ) {
window.location = href;
}
else{
// let the hashchange event handler take care of requesting the page via ajax
location.hash = href;
}
return this;
};