9 April 2016

Liferay: Internet Explorer (IE) and JSON Mime Type

After upgrading to Liferay 6.2 we noticed that some of our portlets quit working in IE while still working with Firefox. Specifically those portlets relying on AJAX calls. Turns out, by default, Liferay 6.2 gives a MIME type “text/javascript” to JSON results delivered to IE. Results delivered to Firefox have a MIME type of “application/json”.

The fix is to disable the JSONContentTypeFilter.

portal-ext.properties

...
com.liferay.portal.servlet.filters.jsoncontenttype.JSONContentTypeFilter=false 
...    

The issue is discussed in LPS-33187. IE 9 had no issue accepting “application/json” so it seems it is there to maintain compatibility with IE8 and earlier browsers?

tags: liferay - 6.2 - EE - IE - internet explorer - json - mime type

Less Is More