Lasso Soft Inc. > Home

[json_header]

Linkjson_header
AuthorJonathan Guthrie
CategoryUtility
Version9.x
LicensePublic Domain
Posted23 Mar 2013
Updated23 Mar 2013
More by this author...

Description

json_header is a method that overcomes MSIE's issue with needing a different MIME type than the rest of the universe.

Sample Usage

json_header

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

/* ==================================
   Sets headers for JSON content
   provides the fix for MSIE not handling JSON content types correctly
   - Thanks to Steffan Cline for pointing this out
==================================	*/

define json_header() => {
   if(web_request->httpUserAgent >> 'MSIE') => {
      web_response->replaceHeader('Content-Type'='text/javascript; charset=' + http_document->encoding)
   else
      web_response->replaceHeader('Content-Type'='application/json; charset=' + http_document->encoding)
   }
}

Comments

No comments

Please log in to comment

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft