Reputation: 2693
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.
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
}
})
And then catch the redirect and use
redirect_302 function(response){
window.location = the url in the response from the server
}
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?
Thanks in advance.
Jenia
Upvotes: 1
Views: 1226
Reputation: 520
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.
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.
Upvotes: 1