From 5fe310600f64c8cec385a0496ef835398472bfcc Mon Sep 17 00:00:00 2001 From: Ghislain Seguin Date: Wed, 29 Jun 2011 19:57:32 -0700 Subject: [PATCH] Fix for #1990: Introducing $.mobile.ajaxCrossDomainEnabled defaults to false --- js/jquery.mobile.core.js | 3 +++ js/jquery.mobile.navigation.js | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/js/jquery.mobile.core.js b/js/jquery.mobile.core.js index 4fe4ab52..e8827400 100644 --- a/js/jquery.mobile.core.js +++ b/js/jquery.mobile.core.js @@ -33,6 +33,9 @@ // Automatically handle clicks and form submissions through Ajax, when same-domain ajaxEnabled: true, + // Allow cross domain XHR, use at your own risks + ajaxCrossDomainEnabled: false, + // Automatically load and show pages based on location.hash hashListeningEnabled: true, diff --git a/js/jquery.mobile.navigation.js b/js/jquery.mobile.navigation.js index 27c41b0d..4283ef39 100644 --- a/js/jquery.mobile.navigation.js +++ b/js/jquery.mobile.navigation.js @@ -612,6 +612,15 @@ $.mobile.showPageLoadingMsg(); } + $.ajaxTransport("+*", function( s ) { + if ( s.crossDomain && !$.mobile.ajaxCrossDomainEnabled ) { + return { + send: $.noop, + abort: $.noop + }; + } + }); + // Load the new page. $.ajax({ url: fileUrl,