Common HTTP ContentType settings for AJAX applications

Source: Internet
Author: User
Tags dbx fdf gcd pkcs12 pkcs7 rfc rfc822

Article Source: Ajax application Common HTTP contenttype settings

In AJAX development, you often encounter the following scenarios:

1 The server needs to return a regular text to the client
2 The server needs to return a piece of HTML code to the client
3 The server needs to return an XML code to the client
4 The server needs to return a piece of JavaScript code to the client
5 The server needs to return a JSON string to the client

For each return type, the canonical practice is to specify the response contenttype on the server side.
(Not a problem in most cases, especially when returning "non-XML")

Code  
    Plain text: Text/plain
    HTML code: text/html
    XML code: Text/xml
More than three can be said to be uncontroversial, but the other two things should be noted.  
JavaScript ContentType by the most standard notation should be Application/javascript. 
and the commonly used text/javascript has been defined by the RfC as obsolete.  
However, it is not recommended to use application/javascript here for the time being
because many older browsers do not support Application/javascript 
and all browsers support text/ JavaScript .  
between standard and broad compatibility, choose the latter for the moment.


JSON's ContentType common notation are: Text/json & Text/javascript.
But this text/json in fact does not exist at all, and text/javascript in some cases the client processing will be ambiguous.
For JSON contenttype, the standard notation defined in the RFC is: Application/json.

There is no doubt that we should choose the Application/json of standard notation.

Finally, attach the ContentType list:

Commonly used for:

Text/plain Text/htmltext/xmltest/javascriptapplication/jsonimage/gifimage/jpeg

Listing:

". *" = "Application/octet-stream" ". 001" = "application/x-001" ". 301" = "application/x-301" ". 323" = "text/h323" ". 906" = " application/x-906 "". 907 "=" drawing/907 "". A11 "=" application/x-a11 "". ACP "=" AUDIO/X-MEI-AAC "". Ai "=" application/ PostScript ". AIF" = "Audio/aiff" ". aifc" = "Audio/aiff" ". Aiff" = "Audio/aiff" ". Anv" = "Application/x-anv". Asa "=" text/ Asa "". asf "=" video/x-ms-asf "". asp "=" text/asp "". asx "=" video/x-ms-asf "". Au "=" audio/basic "". avi "=" Video/avi "". AWF " = "Application/vnd.adobe.workflow" ". Biz" = "Text/xml" ". bmp" = "application/x-bmp" ". Bot" = "Application/x-bot" ". c4t" = " APPLICATION/X-C4T "". C90 "=" Application/x-c90 "". Cal "=" Application/x-cals "". Cat "=" Application/vnd.ms-pki.seccat "" . cdf "=" APPLICATION/X-NETCDF "". Cdr "=" Application/x-cdr "". Cel "=" Application/x-cel "". cer "=" application/ X-x509-ca-cert "". Cg4 "=" Application/x-g4 "". CGM "=" APPLICATION/X-CGM "". cit "=" Application/x-cit "". Class "=" java/* "" . CML "=" Text/xml "". cmp "=" application/x-cmp "". CMX "=" application/x-cmx "". Cot "=" Application/x-cot "".CRL "=" application/pkix-crl "". Crt "=" Application/x-x509-ca-cert "". CSI "=" Application/x-csi "". css "=" text/css "". Cut "=" Application/x-cut "". dbf "=" application/x-dbf "". dbm "=" application/x-dbm "". dbx "=" application/x-dbx "". DCD "=" Text/xml "". Dcx "=" Application/x-dcx "". Der "=" Application/x-x509-ca-cert "". DGN "=" APPLICATION/X-DGN "". Dib "=" Application/x-dib "". dll "=" Application/x-msdownload "". Doc "=" Application/msword "". Dot "=" Application/msword "". DRW "=" APPLICATION/X-DRW "". DTD "=" Text/xml "". DWF "=" MODEL/VND.DWF "". DWF "=" APPLICATION/X-DWF "". dwg "=" application/ X-dwg "". Dxb "=" APPLICATION/X-DXB "". DXF "=" application/x-dxf "". Edn "=" Application/vnd.adobe.edn "". EMF "=" Application/x-emf "". eml "=" message/rfc822 "". Ent "=" Text/xml "". Epi "=" Application/x-epi "". EPs "=" Application/x-ps "" . eps "=" Application/postscript "". etd "=" application/x-ebx "". exe "=" application/x-msdownload "". Fax "=" Image/fax "". FDF "=" Application/vnd.fdf "". Fif "=" Application/fractals "". Fo "=" text/xml "". frm "=" application/x-frm "". G4 "=" appLication/x-g4 "". GBR "=" APPLICATION/X-GBR "". gcd "=" APPLICATION/X-GCD "". gif "=" image/gif "". Gl2 "=" APPLICATION/X-GL2 " ". Gp4" = "Application/x-gp4" ". Hgl" = "Application/x-hgl" ". HMR" = "APPLICATION/X-HMR" ". Hpg" = "APPLICATION/X-HPGL" ". HPL "=" APPLICATION/X-HPL "". hqx "=" application/mac-binhex40 "". Hrf "=" APPLICATION/X-HRF "". HTA "=" Application/hta "". HTC " = "Text/x-component" ". htm" = "text/html" ". html" = "text/html" ". Htt" = "text/webviewhtml" "." HTX "=" text/html "". ICB "=" APPLICATION/X-ICB "". ico "=" Image/x-icon "". ico "=" Application/x-ico "". IFF "=" Application/x-iff "". Ig4 "=" Application /x-g4 "". IGs "=" Application/x-igs "". III "=" Application/x-iphone "". img "=" application/x-img "". Ins "=" application/ X-internet-signup "". ISP "=" Application/x-internet-signup "". IVF "=" VIDEO/X-IVF "". Java "=" java/* "". Jfif "=" Image/jpeg "". Jpe "=" Image/jpeg "". Jpe "=" Application/x-jpe "". jpeg "=" Image/jpeg "". jpg "=" image/jpeg "". jpg "=" application/x-jpg "". js "=" Application/x-javascript "". jsp "=" text/html "". La1 "=" Audio/x-liquid-file "". Lar "="Application/x-laplayer-reg" ". Latex" = "Application/x-latex" ". LAVs" = "Audio/x-liquid-secure" ". LBM" = "application/ X-LBM "". Lmsff "=" Audio/x-la-lms "". ls "=" application/x-javascript "". Ltr "=" application/x-ltr "". m1v "=" Video/x-mpeg " ". m2v" = "Video/x-mpeg" ". m3u" = "Audio/mpegurl" ". m4e" = "VIDEO/MPEG4" ". Mac" = "Application/x-mac" ". Man" = "application/ X-troff-man "". Math "=" Text/xml "". mdb "=" application/msaccess "". mdb "=" Application/x-mdb "". MFP "=" application/ X-shockwave-flash "". mht "=" message/rfc822 "". mhtml "=" message/rfc822 "". Mi "=" Application/x-mi "". Mid "=" Audio/mid "". Midi "=" Audio/mid "". Mil "=" Application/x-mil "". MML "=" Text/xml "". MND "=" Audio/x-musicnet-download "". MNs "=" audio/ X-musicnet-stream "". Mocha "=" Application/x-javascript "". Movie "=" Video/x-sgi-movie "". Mp1 "=" Audio/mp1 "". MP2 "=" Audio/mp2 "". mp2v "=" Video/mpeg "". mp3 "=" Audio/mp3 "". mp4 "=" VIDEO/MPEG4 "". MPa "=" Video/x-mpg "". MPD "=" application/ Vnd.ms-project "". Mpe "=" Video/x-mpeg "". Mpeg "=" Video/mpg "". mpg "=" Video/mpg "". MPGA "=" Audio/rn-mpeg " ". MPP" = "Application/vnd.ms-project" ". MPs" = "video/x-mpeg" ". MPT" = "Application/vnd.ms-project" ". MPV" = "Video/mpg" " . Mpv2 "=" Video/mpeg "". MPW "=" Application/vnd.ms-project "". MPX "=" Application/vnd.ms-project "". MTx "=" Text/xml "". MXP "=" APPLICATION/X-MMXP "". Net "=" Image/pnetvue "". NRF "=" APPLICATION/X-NRF "". NWS "=" message/rfc822 "". odc "=" text/ X-ms-odc "". Out "=" Application/x-out "". P10 "=" Application/pkcs10 "". P12 "=" application/x-pkcs12 "". p7b "=" Application /x-pkcs7-certificates "". p7c "=" Application/pkcs7-mime "". p7m "=" Application/pkcs7-mime "". p7r "=" application/ X-pkcs7-certreqresp "". P7s "=" Application/pkcs7-signature "". Pc5 "=" APPLICATION/X-PC5 "". PCI "=" Application/x-pci "". PCL "=" APPLICATION/X-PCL "". pcx "=" application/x-pcx "". pdf "=" Application/pdf "". pdf "=" Application/pdf "". Pdx "=" Application/vnd.adobe.pdx "". pfx "=" application/x-pkcs12 "". PGL "=" APPLICATION/X-PGL "". Pic "=" Application/x-pic "". Pko "=" Application/vnd.ms-pki.pko "". pl "=" Application/x-perl "". PLG "=" text/html "". Pls "=" audio/scpls "". Plt "=" application/x-plt "". png "=" image/png "". png "=" application/x-png "". Pot "=" Application/vnd.ms-powerpoint "". PPA "=" application/vnd.ms-powerpoint "". ppm "=" application/x-ppm "". pps "=" Application/vnd.ms-powerpoint "". ppt "=" Application/vnd.ms-powerpoint "". ppt "=" application/x-ppt "". PR "=" APPLICATION/X-PR "". PRF "=" application/pics-rules ". prn" = "application/x-prn" ". Prt" = "application/x-prt" ". PS" = "Application/x-ps" ". PS" = "Application/postscript" ". PTN "=" Application/x-ptn "". Pwz "=" Application/vnd.ms-powerpoint "". r3t "=" Text/vnd.rn-realtext3d "". Ra "=" audio/ Vnd.rn-realaudio "". Ram "=" Audio/x-pn-realaudio "". Ras "=" Application/x-ras "". Rat "=" Application/rat-file "". RDF "=" Text/xml "". Rec "=" application/vnd.rn-recording "". Red "=" application/x-red "". RGB "=" Application/x-rgb "". RJs "=" Application/vnd.rn-realsystem-rjs "". Rjt "=" Application/vnd.rn-realsystem-rjt "". RLC "=" APPLICATION/X-RLC "". Rle "=" Application/x-rle "". Rm "=" Application/vnd.rn-realmedia "". Rmf "=" APPLICATION/VND.ADOBE.RMF "". RMI "=" Audio/mid "". Rmj "=" APPLICATION/VND.RN-REALSYSTEM-RMJ "". RMM "=" Audio/x-pn-realaudio "". RMP "=" application/vnd.rn-rn_ Music_package "". RMS "=" Application/vnd.rn-realmedia-secure "". rmvb "=" APPLICATION/VND.RN-REALMEDIA-VBR "". Rmx "=" Application/vnd.rn-realsystem-rmx "". Rnx "=" Application/vnd.rn-realplayer "". RP "=" Image/vnd.rn-realpix "". RPM "=" Audio/x-pn-realaudio-plugin "". Rsml "=" APPLICATION/VND.RN-RSML "". RT "=" Text/vnd.rn-realtext "". rtf "=" application/ MSWord ". rtf" = "Application/x-rtf" ". RV" = "Video/vnd.rn-realvideo" ". Sam" = "Application/x-sam" ". Sat" = "application/ X-sat "". SDP "=" APPLICATION/SDP "". Sdw "=" Application/x-sdw "". Sit "=" Application/x-stuffit "". SLB "=" application/ X-SLB "". SLD "=" APPLICATION/X-SLD "". SLK "=" drawing/x-slk "". Smi "=" Application/smil "". Smil "=" Application/smil "". SMK "=" APPLICATION/X-SMK "". snd "=" Audio/basic "". Sol "=" Text/plain "". Sor "=" Text/plain "". SPC "=" application/ X-pkcs7-certificates "". SPL "=" Application/futuresplash "". spp "=" Text/xml "". SSM "=" Application/streamingmedia "". SSt= "Application/vnd.ms-pki.certstore" ". StL" = "Application/vnd.ms-pki.stl" ". stm" = "text/html" ". Sty" = "application/ X-sty "". svg "=" text/xml "". swf "=" Application/x-shockwave-flash "". TDF "=" APPLICATION/X-TDF "". TG4 "=" application/ X-TG4 "". TGA "=" application/x-tga "". tif "=" Image/tiff "". tif "=" application/x-tif "". Tiff "=" Image/tiff "". TLD "=" text/ XML ". Top" = "drawing/x-top" ". Torrent" = "application/x-bittorrent" ". Tsd" = "text/xml" ". txt" = "Text/plain" ". UIn" = " Application/x-icq "". Uls "=" Text/iuls "". vcf "=" Text/x-vcard "". Vda "=" Application/x-vda "". vdx "=" application/ Vnd.visio "". VML "=" Text/xml "". VPg "=" application/x-vpeg005 "". Vsd "=" Application/vnd.visio "". Vsd "=" application/ X-vsd "". vss "=" Application/vnd.visio "". vst "=" Application/vnd.visio "". vst "=" Application/x-vst "". Vsw "=" Application/vnd.visio "". Vsx "=" Application/vnd.visio "". vtx "=" Application/vnd.visio "". Vxml "=" Text/xml "". wav "=" Audio/wav "". Wax "=" audio/x-ms-wax "". Wb1 "=" application/x-wb1 "". Wb2 "=" application/x-wb2 "". Wb3 "=" application/x-wb3 " ". wbmp "=" Image/vnd.wap.wbmp "". Wiz "=" Application/msword "". Wk3 "=" Application/x-wk3 "". Wk4 "=" Application/x-wk4 "". Wkq "=" APPLICATION/X-WKQ "". Wks "=" Application/x-wks "". Wm "=" VIDEO/X-MS-WM "". wma "=" audio/x-ms-wma "". WMD "=" APPLICATION/X-MS-WMD "". Wmf "=" application/x-wmf "". WML "=" TEXT/VND.WAP.WML "". wmv "=" video/x-ms-wmv "". Wmx "=" video/ X-ms-wmx "". wmz "=" Application/x-ms-wmz "". Wp6 "=" Application/x-wp6 "". WPD "=" APPLICATION/X-WPD "". WPG "=" application/ X-WPG "". WPL "=" APPLICATION/VND.MS-WPL "". Wq1 "=" application/x-wq1 "". Wr1 "=" Application/x-wr1 "". Wri "=" application/ X-wri "". Wrk "=" Application/x-wrk "". ws "=" Application/x-ws "". Ws2 "=" Application/x-ws "". WSC "=" Text/scriptlet "". wsdl "=" Text/xml "". wvx "=" video/x-ms-wvx "". Xdp "=" APPLICATION/VND.ADOBE.XDP "". XDR "=" Text/xml "". XfD "=" application/ Vnd.adobe.xfd "". Xfdf "=" application/vnd.adobe.xfdf "". xhtml "=" text/html "". xls "=" application/vnd.ms-excel "". xls "= "Application/x-xls" ". xlw" = "APPLICATION/X-XLW" ". xml" = "Text/xml" ". xPL" = "Audio/scpls" ". Xq" = "Text/xml"". Xql" = "Text/xml" ". XQuery" = "Text/xml" ". xsd" = "text/xml" ". xsl" = "Text/xml" ". xslt" = "text/xml". Xwd "=" application/ X-xwd "". X_b "=" Application/x-x_b "". x_t "=" application/x-x_t "

Common HTTP ContentType settings for AJAX applications

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.