TinyMCE, IE9, stripping <script> tags
Good evening, first question here!
I've looked and I've looked, and I've found solutions that don't work. My problem is that IE9 开发者_StackOverflow社区(and 8, 7 etc) will strip tags in TinyMCE 3.4.3.2.
I'm afraid my circumstances are a little unique: I'm working with an existing CMS (custom) which is a little outdated, made in Java, and isn't XHTML-friendly. There is a custom plugin that allows you to insert some script code, then surrounds it with CDATA
tags. Essentially:
insertHTML(document.videoForm.myobj.value);
Where insertHTML, well, inserts it where the cursor was. Now, this works fantastically in Chrome, Firefox etc, but fails in IE. After inserting the script via a popup textarea box, then using TinyMCE's built in HTML viewer, the <script>
tags disappear. Putting a <br />
before the script tags makes it work for some reason, but this is undesirable as many clients don't know what HTML is.
Using IE9's developer...thing...I found some errors.
HTML1114: Codepage unicode from (UNICODE byte order mark) overrides conflicting codepage windows-1252 from (11)
Triggered by the doctype
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd">
WHICH IS WRONG, I KNOW, and I want to change it, but I am under quite strict limitations here, and I don't have access to wherever that doctype is rendered.
Another thing: here is the extended_valid_elements thingymajig:
extended_valid_elements: "SCRIPT[language<JavaScript?JavaScript1.1?JavaScript1.2?JScript?php?VBScript|src|wgtsrc|type<text/javascript?mce-text/javascript?javascript],script[language<JavaScript?JavaScript1.1?JavaScript1.2?JScript?php?VBScript|src|wgtsrc|type<text/javascript?mce-text/javascript?javascript],form[name|method|action|id|target|onsubmit],FORM[name|method|action|id|onclick|target|onsubmit],embed[src|type|wmode|width|height],object[class|id|classid|codebase|width|height]"
If you can spot anything in there that could throw IE off, do point it out. If you can tell me that the strange doctype is throwing it off, let me know and I'll ask my employer where he buried that...
TL;DR: IE9 strips tags in TinyMCE 3.4.3.2, possibly due to doctype.
Are the script tags self closing? If they are self closing script tags then IE will have issues.
Why don't self-closing script tags work?
Example of self closing script tag:
<script src="" />
IE compatible format:
<script src=""></script>
I think this is related to this SO question: Why HTML1113: Document mode restart from IE9 Standards to Quirks
See the solution there.
精彩评论