Opened 13 years ago

Closed 13 years ago

#496 closed Bug (invalid)

editor fails to load content with <script> tags in "inline" mode, textarea replace OK

Reported by: Lloyd Standish Owned by:
Priority: Normal Milestone:
Component: General Version: FCKeditor 2.4.2
Keywords: Cc:

Description

Starting the editor with properly-escaped starting "value" does not load content properly when editor is started in "inline" mode, while exactly the same content loads properly in "textarea replace" mode. The following example javascript load data should make the problem clear:

<script type="text/javascript">
var oFCKeditor = new FCKeditor('edited');
oFCKeditor.BasePath = "/FCKeditor/" ;
oFCKeditor.Config["CustomConfigurationsPath"] = "/myfckconfig.js"  ;
oFCKeditor.Config["BaseHref"] = "http://fckwebedit.anemiaanswer.com/examples/" ;
oFCKeditor.Height = "100%" ;
oFCKeditor.Config["mytop"] = "None" ;
oFCKeditor.Config["mytail"] = "None";
oFCKeditor.Config["mypath"] = "./examples";
oFCKeditor.Config["mytitle"] = "";
oFCKeditor.Config["strict"] = "0";
oFCKeditor.Value = " <p>Standish and Co. (USA) CR Natural, S.A.&nbsp; (Costa Rica)</p> <script type=\"text/javascript\" language=\"javascript\"> <!-- var ANS_customer_id=\"066fc456-c071-48d3-aa1f-0542ead8f44b\";--></script> <p>See also:<br> <b><a href=\"questions-and-answers.htm\">Carao Questions and Answers<br></a></b></p> ";
oFCKeditor.Create();
</script>

Change History (3)

comment:1 Changed 13 years ago by Lloyd Standish

I should have specified that the failure to load only occurs when there are <script> </script> tags in the text loaded into the editor.

comment:2 Changed 13 years ago by Lloyd Standish

Browser output for the example data given looks like this:

See also: Carao Questions and Answers '; oFCKeditor.Create();

That is, the FCKeditor is not loaded. The tag <script type="text/javascript"> at the top of my example is being closed by the first </script> tag encountered in 'oFCKeditor.Value', so oFCKeditor.Create(); is not executed.

I simply cannot believe this is really a bug... it must be an error in the way I am loading the editor! Still, the only work-around I can see is to mangle any </script> tags loaded by 'oFCKeditor.Value' (very awkward!)

comment:3 Changed 13 years ago by Alfonso Martínez de Lizarrondo

Keywords: inline mode script textarea removed
Priority: HighNormal
Resolution: invalid
Status: newclosed

If you try to validate that html page you'll find that it's invalid. The browser will see the </script> inside the string and close the script element.

The solution is to escape it : <\/script>

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy