OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

TinyMCE strips out javascript when it contains HTML tags

  • Thread starter Thread starter vdawg
  • Start date Start date
V

vdawg

Guest
TinyMCE seems to strip out Javascript in a specific case of the content. In my test, I view a page with the editor and open the editor's Source Code window to manually insert the following code:

Code:
<script>
document.getElementById('test').innerHTML = 'Replacement text';
</script>

Then I close the Source Code window using its "Save" button. If I then re-open the Source Code window, the code is there. However, if I modify the code by adding an HTML tag in the quoted replacement text as part of the innerHTML assignment:

Code:
<script>
document.getElementById('test').innerHTML = '<b>Replacement text</b>';
</script>

close the window with "Save", then re-open it, all of the Javascript is removed and the Source Code window is empty.

I'm unsure if I need to change an initialization property to allow this to work properly or if this is a bug.

Thanks!

<p>TinyMCE seems to strip out Javascript in a specific case of the content. In my test, I view a page with the editor and open the editor's Source Code window to manually insert the following code:</p>
<pre><code><script>
document.getElementById('test').innerHTML = 'Replacement text';
</script>
</code></pre>
<p>Then I close the Source Code window using its "Save" button.
If I then re-open the Source Code window, the code is there.
However, if I modify the code by adding an HTML tag in the quoted replacement text as part of the innerHTML assignment:</p>
<pre><code><script>
document.getElementById('test').innerHTML = '<b>Replacement text</b>';
</script>
</code></pre>
<p>close the window with "Save", then re-open it, all of the Javascript is removed and the Source Code window is empty.</p>
<p>I'm unsure if I need to change an initialization property to allow this to work properly or if this is a bug.</p>
<p>Thanks!</p>
 

Latest posts

Z
Replies
0
Views
1
zuegelwagen
Z
Top