#3817 closed Bug (invalid)
fckeditor crashes when loading page with script
Reported by: | Kenny | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | FCKeditor 2.6.3 |
Keywords: | Cc: |
Description
I don't think the problem is related to the editor itself , but more likely by how IE6 handles scripts.
When creating an fckeditor instance , as following :
var oFCKeditor = new FCKeditor( 'FCKTEXT' ) ; oFCKeditor.BasePath = 'script/fckeditor/' ; oFCKeditor.Value = 'test<br/>test<script></script>test2' ; oFCKeditor.Create();
If i run this , the editor crashes ( no fckeditor box is shown ) . It does show the following text :
test2' ; oFCKeditor.Create();
So , me guess is that , when IE6 encounters the a script block , it tries to execute it , regardless of whether it is inside quotes or not.
Change History (5)
comment:1 Changed 16 years ago by
Keywords: | fckeditor crash loading script removed |
---|---|
Resolution: | → invalid |
Status: | new → closed |
comment:2 Changed 16 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
You are right , i tested it with
oFCKeditor.Value = '<html><head><script>alert("test")</script></head><body>test<body></html>' ;
And it worked.
However , that doesn't solve the issue : the editor shouldn't 'crash' just because the content is wrongly aligned , should it ?
The problem occurs mainly when copying something from a website into the editor. This works fine , and so does saving the contents. However , when reloading the saved contents , the <script> parts crash the editor.
comment:3 Changed 16 years ago by
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
Again, this is no crash, and it just a problem with your page, FCKeditor doesn't know anything about the rest of the code, the browser is trying to make sense of your code and you get that.
Use the HTML validator and everything will work.
comment:4 Changed 16 years ago by
I think we are misunderstanding each other : it's not a problem with scripts on the page where i'm starting up the editor.
It's crashing on scripts inside a the string that is used to feed the editor data.
The browser interprets the <script> part , even if it's inside quotes.
Nevermind though , i just wanted to know if there was a solution for it.
comment:5 Changed 16 years ago by
Yes, the browser understands the </script> inside the string as the closing tag for the real <script> tag. This has nothing to do with FCKeditor actually.
To fix this, you should replace all </script> occurrences with <\/script> when inserting the value to be loaded in your page.
That's not a crash, it's just invalid HTML.
Validate your page and when you fix all the errors FCKeditor will work