http重定向与cordova,如何重新加载页面重定向到浏览器?

编程入门 行业动态 更新时间:2024-10-09 21:24:55
本文介绍了http重定向与cordova,如何重新加载页面重定向到浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用cordova部署我的服务器 - 客户端应用程序。 提交表单后,服务器可能会重定向客户端:302重定向和所有。 在这种情况下,应用程序尝试从服务器加载页面,而不是自己的内存。

I'm using cordova to deploy my server-client app. After submitting a form, the server may redirect the client: 302 redirect and all. In this case, the app tries to load the page from the server instead of its own memory.

我正在寻找一个解决方案。要重申,我希望应用程序加载从自己的文件系统重定向到的文件。

I'm looking for a solution to this. To reiterate, I want the app to load the file it's being redirected to from its own file system.

我想到的是这样的:我使用jquery提交所有表单并捕获这些重定向。

What I have in mind is something like this: I submit all forms using jquery and catch those redirects.

$.ajax({ url : address, type : type, data : values, statusCode: { 302 : redirect_302 } })

然后捕获重定向并使用

redirect_302 function(response){ window.location = the url in the response from the server }

这是一个典型的解决方案吗? 或者有更好/更简单的选项吗? 也许我可以在sych中发出重定向,cordova不会,默认情况下,尝试从服务器加载页面?

Is that a typical solution? Or are there better/simpler options? Maybe I can issue the redirect in sych a way that cordova will not, by default, try to load the page from the server?

提前感谢。

Jenia

推荐答案

选项是做你正在做的事。让服务器返回正确的重定向,不太可能是因为它是一个文件或从服务器加载文件。

The options are to do what you are doing. Have the server return the proper redirect, unlikely since it is a file or load the file from the server.

重定向包含一个网址,应用程序被告知使用服务器所以没有任何东西自动为cordova做。

The redirect contains a url that the application is told to use by the server so there isn't anything automatic for cordova to do.

更多推荐

http重定向与cordova,如何重新加载页面重定向到浏览器?

本文发布于:2023-10-12 05:12:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1483813.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重定向   加载   浏览器   页面   http

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!