IE9 stripping opening HTML tags in AJAX response

72 views Asked by At

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)

IE9 watch tab - opening html tags stripped

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)

1

There are 1 answers

0
ryantkelly On

Solved!

By using htmlentities() on the string prior to echoing with json_encode(), the tags were preserved!