How can I convince IE to simply display application/json rather than offer to download it?

前端 未结 9 536
野的像风
野的像风 2020-11-22 14:57

While debugging jQuery apps that use AJAX, I often have the need to see the json that is being returned by the service to the browser. So I\'ll drop the URL for the JSON da

9条回答
  •  伪装坚强ぢ
    2020-11-22 15:43

    Above solution was missing thing, and below code should work in every situation:

    Windows Registry Editor Version 5.00
    ;
    ; Tell IE to open JSON documents in the browser.  
    ; 25336920-03F9-11cf-8FD0-00AA00686F13 is the CLSID for the "Browse in place" .
    ;  
    
    [HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/json]
    "CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
    "Encoding"=hex:08,00,00,00
    
    [HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/x-json]
    "CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
    "Encoding"=hex:08,00,00,00
    
    [HKEY_CLASSES_ROOT\MIME\Database\Content Type\text/json]
    "CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
    "Encoding"=hex:08,00,00,00
    

    Just save it file json.reg, and run to modify your registry.

提交回复
热议问题