PHP is returning the following JSON object:
{
"error": false,
"message": "PLM File read.",
"value": "<h2>Select Columns</h2>"
}
Which is handled nicely in Chrome, Firefox, etc.
I need to support IE9, and IE9 is stripping out the opening <h2>
tags from value
(pardon the screenshot, I am running IE9 in a VM)
JSONLint says my JSON object is valid.
I've tried padding the string with "sacrificial" tags (additional <h2>
) but those are also stripped out.
In a larger returned string (a <div>
containing other tags) all opening HTML tags are stripped out - so it sounds like IE9 just hates opening HTML tags!
IE9 is running in "IE9 standards mode".
(Similar to this question - Jquery AjaxSubmit + json datatype stripped HTML in IE9 - which is unanswered)
Solved!
By using
htmlentities()
on the string prior to echoing withjson_encode()
, the tags were preserved!