7

I'm trying to integrate DotNetOpenAuth with a site that uses jquery mobile. I'm running into an issue where jquery mobile appears to be canceling a 302 redirect to the providing party (an external site) that the server is responding with.

I've tried turning off the default jquery mobile ajax handling with the following in the mobileinit event:

$.mobile.ajaxEnabled = false;

If I take jquery mobile out of the picture the 302 redirect is handled correctly and the OpenID integration with the providing party works fine.

Can anyone tell me how to make jquery mobile correctly handle the 302 redirect to an external site?

joshb
  • 5,182
  • 4
  • 41
  • 55
  • Related: http://stackoverflow.com/questions/199099/how-to-manage-a-redirect-request-after-a-jquery-ajax-call you might need to write your own method to handle this. Looking over the jQM code I only see and success/error in the ajax call: http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.js – Phill Pafford Oct 10 '11 at 13:29

3 Answers3

8

For forms just set "data-ajax" attribute to false.

It should be like this:

<form action="postthis" method="post" data-ajax="false">

This will disable default ajax handling of jQuery mobile.

Reference: http://jquerymobile.com/test/docs/forms/forms-sample.html

Korayem
  • 12,108
  • 5
  • 69
  • 56
1

I had the same problem and was able to login after adding rel="external" to the login link, see example below

<a href="/authentication/logon" rel="external" data-icon="gear" class="ui-btn-right">Login</a>

I'm not sure if this is the solution you are looking for?

orjan
  • 1,482
  • 1
  • 19
  • 35
0

To disable Ajax you should add this script just before the script reference to jquery mobile:

 <script language="javascript" type="text/javascript">
        $(document).bind('mobileinit', function () {

            $.mobile.ajaxEnabled = false;
         });
 </script>

Redirecting to an external url does work if you don't use Ajax.
But there should be an alternative where you don't need to disable Ajax.

pauloya
  • 2,535
  • 3
  • 30
  • 50
  • I thought I had tried that (with no luck) but I may have had the placement of the script wrong. I'll give it a try later today. Thanks – joshb Oct 13 '11 at 16:08