最近用blueimp上传图片的时候,发现在ie下上传失败,总是提示下载文件。后研究发现,是由于ie8不支持aplication/json的缘故,故需要强制将ie的content-type设定为text/plain ,设置代码如下:
if (isset($_SERVER['HTTP_ACCEPT']) &&
(strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false)) {
$response->headers->set('Content-type', 'application/json; charset=utf-8');
} else {
$response->headers->set('Content-type', 'text/plain; charset=utf-8');
}。
因为本人项目中用的是symfony2,对于项目返回的response的对象在eventLister中的onKernelResponse方法中做了统一处理,所以在control中修改header的content-type信息一直失败。后来才发现eventLister中有关于 这个统一设定。
参考资料:
ie 不支持 aplication/json :
https://github.com/blueimp/jQuery-File-Upload/issues/123
https://github.com/astaxie/beego/issues/165
http://stackoverflow.com/questions/13943439/json-response-download-in-ie710
https://github.com/blueimp/jQuery-File-Upload/issues/123
http://stackoverflow.com/questions/13943439/json-response-download-in-ie710
accept:Vary:
http://stackoverflow.com/questions/1975416/trying-to-understand-the-vary-http-header
http://keystonewebsites.com/articles/mime_type.php
http://www.456bereastreet.com/archive/200408/content_negotiation/
http://blogs.msdn.com/b/ieinternals/archive/2009/06/17/vary-header-prevents-caching-in-ie.aspx
http://blogs.msdn.com/b/ieinternals/archive/2009/06/17/vary-header-prevents-caching-in-ie.aspx
相关推荐
JavaScript Object Notation (aka JSON) is a very popular alternative to XML for transmitting data to the web browser. Flexjson is a lightweight library for serializing and deserializing Java objects ...
目前,预计文件具有以下扩展名: // tries to transform // *.yaml.fm// *.json.fmvar page = require ( './articles/page.yaml.fm' ) ; // YAML front mattervar other = require ( './articles/other.json.fm' ) ...
Resume: By default, gwget tries to continue any download. Notification: Gwget tries to use the Gnome notification area support, if available. You can close the main window and gwget runs in the ...
0 , //cliocked itles at the beginning of the game time : 30 , // game level timeout, for example a user can refresh the game, each game has to initiate with an original timeout tries : 3 , // r...
aria2 can download a file from multiple sources/protocols and tries to utilize your maximum download bandwidth. It supports downloading a file from HTTP(S)/FTP/SFTP and BitTorrent at the same time, ...
aria2 can download a file from multiple sources/protocols and tries to utilize your maximum download bandwidth. It supports downloading a file from HTTP(S)/FTP/SFTP and BitTorrent at the same time, ...
Multicat tries to rebuild the internal clock of the input stream; but it wants to remain agnostic of what is transported, so in case of files the said clock is stored to an auxiliary file (example...
A monolithic application is a single application that tries to get numerous tasks accomplished at once. Then, as new features are needed, the application will get bigger and bulkier. This, in effect,...
- Prompt user when a page tries to unload it - Supports FCKEditor editor* - Supports Xinha editor* - Supports States - Supports Databinding - Supports Styles - Customizable function to handle ...
If the kext is instead in /Extra the system errors out when it tries to load the kext in this case. If someone knows how to fix this dependency please let me know. OSX 10.5.x and 10.6.0 versions ...
It tries to make easy things easy and hard things possible. You can generate plots, add dimensions to the plots, and also make the plots interactive with just a few lines of code with matplotlib. ...
This project tries to target the vacuum behind the enormous evolution of online mapping the last decade. There are situations when keeping a lot of structured map data in a device for the field is ...
The new approach tries to overcome these struggles–it gives users much more control over the hardware, but also many more responsibilities. This way application developers can release the full ...
You can download a demo which includes the component as .NET, Delphi and ActiveX component and a small example application. The source for the components (C# and Pascal) is included as well. It ...
For instance, the book recommends against the use of some of the IPv6 standard APIs - unfortunately, there are some IPv6 APIs that are inherently insecure, so the book tries to avoid (and discourage)...
hashes, and tries to recover plain-text passwords. If it's possible to recover the password in a reasonable time, the password should be considered to be insecure. Some users like simple and easy to ...
Later is supported when map2dbg.exe tool is placed in \Bin folder of EurekaLog installation (separate download is required) 5)....Added: Exception2HRESULT in EAppDLL to simplify developing DLLs with ...
Application of the consultant role to parent-teacher management of school avoidance behavior APPLICATION OF T H E CONSULTANT ROLE TO PARENT-TEACHER MANAGEMENT OF SCHOOL AVOIDANCE BEHAVIOR JO ANN ...