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

Set Content-Type to application/json in response #7

Closed
aaronchi opened this issue Apr 20, 2012 · 6 comments
Closed

Set Content-Type to application/json in response #7

aaronchi opened this issue Apr 20, 2012 · 6 comments

Comments

@aaronchi
Copy link

I noticed that the plugin doesn't work if you actually return a json response. It seems to only work if you send a text/html response with json in it. I assume this is due to the way that the response is being parsed in the javascript.

Great start on a simple upload plugin though. Would be great to extend it and include a list view as well with a configurable endpoint for pulling in the image details.

Thanks!

@PerfectlyNormal
Copy link
Owner

Yeah, I know it has a few warts. Found some code that did the job, packaged it and played around 'til I got it working "good enough" for my needs. Planning on making it a bit nicer as time permits.

I see I forgot to mention the content_type bit. Wrote a short line in the readme, and I'll see if I can't get that fixed as well. Thanks for letting me know.

@PerfectlyNormal
Copy link
Owner

Gave this a little try today, and got it working in Safari, Chrome and the likes when using application/json or text/javascript or pretty much any encoding. Only problem was IE, who attempts to download it the second something other than text/html gets sent.

So from what I can see while researching, as long as we use a iframe for the uploading (which needs to be done to support IE and Opera), the content-type needs to be text/html or text/plain

@Darkside73
Copy link

Can you publish your efforts as a branch? I'm don't care about IE and Opera

@PerfectlyNormal
Copy link
Owner

Hi.

I'm terribly sorry, but looks like I don't have that any more. I've moved machines since I played around with that, and that little experiment disappeared.

Don't really remember how I did it either. Sorry about that.

@Looooong
Copy link

can we append format to the link? Like /tinymce_assets.json

@PerfectlyNormal
Copy link
Owner

@Looooong might be possible to do and get a sensible response. Have you tried it?

The url the plugin uses can be customized. I don’t remember the exact parameter name, but it’s listed in the readme

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

5 participants