jquery mobile canceling 302 redirect to external site

别来无恙 提交于 2019-12-06 02:23:44

问题


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?


回答1:


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




回答2:


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?




回答3:


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.



来源:https://stackoverflow.com/questions/7700959/jquery-mobile-canceling-302-redirect-to-external-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!