").html(settings.androidPostUnsupportedMessageHtml).dialog(settings.dialogOptions);
+ } else {
+ alert(settings.androidPostUnsupportedMessageHtml);
+ }
+
+ return deferred.reject();
+ }
+
+ var $preparingDialog = null;
+
+ var internalCallbacks = {
+
+ onPrepare: function (url) {
+
+ //wire up a jquery dialog to display the preparing message if specified
+ if (settings.preparingMessageHtml) {
+
+ $preparingDialog = $("
").html(settings.preparingMessageHtml).dialog(settings.dialogOptions);
+
+ } else if (settings.prepareCallback) {
+
+ settings.prepareCallback(url);
+
+ }
+
+ },
+
+ onSuccess: function (url) {
+
+ //remove the perparing message if it was specified
+ if ($preparingDialog) {
+ $preparingDialog.dialog('close');
+ };
+
+ settings.successCallback(url);
+
+ deferred.resolve(url);
+ },
+
+ onFail: function (responseHtml, url) {
+
+ //remove the perparing message if it was specified
+ if ($preparingDialog) {
+ $preparingDialog.dialog('close');
+ };
+
+ //wire up a jquery dialog to display the fail message if specified
+ if (settings.failMessageHtml) {
+ $("
").html(settings.failMessageHtml).dialog(settings.dialogOptions);
+ }
+
+ settings.failCallback(responseHtml, url);
+
+ deferred.reject(responseHtml, url);
+ }
+ };
+
+ internalCallbacks.onPrepare(fileUrl);
+
+ //make settings.data a param string if it exists and isn't already
+ if (settings.data !== null && typeof settings.data !== "string") {
+ settings.data = $.param(settings.data);
+ }
+
+
+ var $iframe,
+ downloadWindow,
+ formDoc,
+ $form;
+
+ if (httpMethodUpper === "GET") {
+
+ if (settings.data !== null) {
+ //need to merge any fileUrl params with the data object
+
+ var qsStart = fileUrl.indexOf('?');
+
+ if (qsStart !== -1) {
+ //we have a querystring in the url
+
+ if (fileUrl.substring(fileUrl.length - 1) !== "&") {
+ fileUrl = fileUrl + "&";
+ }
+ } else {
+
+ fileUrl = fileUrl + "?";
+ }
+
+ fileUrl = fileUrl + settings.data;
+ }
+
+ if (isIos || isAndroid) {
+
+ downloadWindow = window.open(fileUrl);
+ downloadWindow.document.title = settings.popupWindowTitle;
+ window.focus();
+
+ } else if (isOtherMobileBrowser) {
+
+ window.location(fileUrl);
+
+ } else {
+
+ //create a temporary iframe that is used to request the fileUrl as a GET request
+ $iframe = $("