Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

JSONP Responses Are text/plain #95

Open
bdrhoa opened this issue May 2, 2013 · 7 comments
Open

JSONP Responses Are text/plain #95

bdrhoa opened this issue May 2, 2013 · 7 comments

Comments

@bdrhoa
Copy link

bdrhoa commented May 2, 2013

When allow_jsonp = true is specified in the .ini file, jsonp responses should return with MIME type but it's being set to text/plain instead.

@snej
Copy link

snej commented May 2, 2013

TouchDB doesn't use any .ini files. Are you sure you don't mean the old Couchbase Mobile For Android, which is a straight port of CouchDB? We don't support that anymore.

@bdrhoa
Copy link
Author

bdrhoa commented May 2, 2013

Yeah, sorry. I just took over this project and there's conflicting info on
what library it's using.

Does TouchDB for Android support JSONP correctly?


www.maf.org/rhoads
www.ontherhoads.org

On Thu, May 2, 2013 at 4:39 PM, Jens Alfke [email protected] wrote:

TouchDB doesn't use any .ini files. Are you sure you don't mean the old
Couchbase Mobile For Android, which is a straight port of CouchDB? We don't
support that anymore.


Reply to this email directly or view it on GitHubhttps://github.com//issues/95#issuecomment-17369335
.

@snej
Copy link

snej commented May 2, 2013

I don't think there's any JSONP support; I'm only vaguely aware of what it is, actually.

It sounds like this is used for cross-origin script loading. What's the structure of your app like, that causes you to need this? Normally everything is being loaded from the same imaginary domain that's hosted on the device.

You might also search the Google group/mailing list to see if this has come up before.

@bdrhoa
Copy link
Author

bdrhoa commented May 9, 2013

In general, it's needed for a couchapp to communicate with another couchapp
running on another domain, e.g. on another device; we're doing both divice
to server communication and device to device communication. Note I'm not
talking about replication here, but specific application logic.

For example, I use JSONP so that the device can check the server for a more
recient version of the couchapp, by looking at a document called
appinfo.json.

I was was also considering this approach to search for other instances of
our couchapp on the network.
On May 2, 2013 4:53 PM, "Jens Alfke" [email protected] wrote:

I don't think there's any JSONP support; I'm only vaguely aware of what it
is, actually.

It sounds like this is used for cross-origin script loading. What's the
structure of your app like, that causes you to need this? Normally
everything is being loaded from the same imaginary domain that's hosted on
the device.

You might also search the Google group/mailing list to see if this has
come up before.


Reply to this email directly or view it on GitHubhttps://github.com//issues/95#issuecomment-17369851
.

@jchris
Copy link
Contributor

jchris commented Jul 24, 2013

I'm having a hard time why you need JSONP on the mobile device? Please reopen with a little about the use case so we can gauge which milestone this belongs to.

@jchris jchris closed this as completed Jul 24, 2013
@bdrhoa
Copy link
Author

bdrhoa commented Jul 26, 2013

I don't see how to reopen the issue. But like I said above, there are times when it would be useful for our couchapp running on one device to be able to talk to another instance of the app running on another device. The example I gave above is to check if the app on the other device has a more recent version of the couchapp and if so, kick off a replication. JSONP is necessary to get around the AJAX/browser same origin restriction and do the check against the appinfo.json doc we store the version info in. Remember our users are almost always offline. One guy will get internet access someplace and then he can share the app update "back in the village".

Another thing I'd like to do is once I've discovered another app on the network on the Android side of our app (I have this working, BTW and will be posting soon.) is have the couchapp browse to other device's documents to select them for replication. Again, I'd need to make an AJAX call to the other device and thus need JSONP.

So it's not needed for a strictly native app, but it is needed for hybrid apps using couchapp. And there's something to be said for feature parity.

@tleyden
Copy link

tleyden commented Jul 27, 2013

@bdrhoa Thanks for the explanation on your usage case. I'm re-opening.

@jchris any comments on this?

@tleyden tleyden reopened this Jul 27, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants