Jquery mobile canceling 302 redirect to external site

I am trying to integrate DotNetOpenAuth with a site using jquery mobile. I ran into a problem when jquery mobile seems to cancel 302 redirection to the side providing the side (external site) the server is responding to.

I tried to disable the default jQuery processing of mobile ajax with the following in the mobileinit event:

$.mobile.ajaxEnabled = false; 

If I take jquery mobile from the picture, the 302 redirect will be processed correctly, and the OpenID integration with the provider will work fine.

Can someone tell me how to get jquery mobile to properly handle 302 redirects to an external site?

+6
source share
3 answers

For forms, just set the data-ajax attribute to false.

It should be like this:

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

This will disable the default ajax processing for jQuery mobile.

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

+7
source

I had the same problem and was able to log in 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?

+1
source

To disable Ajax, you must add this script immediately before the script link to jquery mobile:

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

Redirecting to an external URL works if you are not using Ajax.
But there should be an alternative where you do not need to disable Ajax.

0
source

Source: https://habr.com/ru/post/898906/


All Articles