tags:

views:

2663

answers:

8

I'm attempting to debug my web application with FireFox3. However, when a JSON feed comes from my application, Firefox wants to open up the "application/json" in a new program. Is there a way to configure FireFox3 to handle JSON like regular text files and open up the JSON in the current tab?

Thanks.

+1  A: 

What is the content-type of the Json feed. Sounds like it may be some sort of application instead of text.

Change the content type of the feed to something that is text based and FireFox will no longer try to open it in another program.

jW
A: 

Hmm, I thought of that... it's sent from Rails. Rails must be setting the mime type to "application/json" However, is there a way to force Firefox to accept it as text?

JP
You can force firefox to accept it by setting the application to read it, as stated by mfx, but it would be better to force Rails to send it as a different application type.
jW
+2  A: 

I would look into the preferences > applications list. What application is targeted for "application/*" ?

Apart from that, are you using FireBug? Absolutely essential, since you can look at the headers and response content within the network view.

mfx
+8  A: 

Try the Open in browser extension.

[edit 30.05.2010 - updated the link]

Nickolay
That link has broken. Here's Open in Browser now: http://www.spasche.net/openinbrowser/
Jason Prado
+2  A: 

Consider using a MIME type of text/javascript instead of application/json

stv
I like this solution the best, since it doesn't require installing another extension. Of course, if you don't have control over the content type, then the extension sounds like the way to go.
pkaeding
+10  A: 

The JSONView firefox extension is really nice.

It formats, highlights, etc...

The only drawback is that it requires the mime type to be set to "application/json". But it is not realy a drawback for you, because based on your "answer"(which shouldn't be an answer) your problem is that the mime type is "application/json" and as a result firefox doesn't know what to do with it and downloads it instead of displaying.

JSONView

Kalmi
Thanks! Though I think many of us will prefer an english link instead: https://addons.mozilla.org/en-US/firefox/addon/10869
Peter Wagenet
Thanks for pointing that out! Corrected now.
Kalmi
+1  A: 

I would just use Firebug - it'll let you drill down into a JSON object on its own, along with its other hundred useful features.

philfreo
+1 Firebug is my debug extension of choice as well
Geek Num 88
A: 

Having JSON sent with an application/json mimetype is correct and changing that would be wrong.

text/javascript is considered obsolete.

dsas