Unfortunately, we are not aware of any way to fix this issue. The problem is that the editor document is treated by the browser just like a normal web page. If there are scripts inside the page, we cannot stop the browser from executing them. This means that each time you go into edit mode, all scripts in the editor content will be executed and the content of the editor will be modified.
I have a suggestion that we have not tested, but it might work for you. Instead of using document.write
, insert a new element in the editor content, e.g. <div id="test"></div> and then set the content of this element with the script. This way the script will modify the same part of the content each time and you should have no problems with duplicated text.
Another approach to to fix the problem you need to know when the script is inside the editor and if it is - do not write anything. For example:
| document.write('m' + 'ike'+'@'+'t'+'winharbor'+'.'+'com');
The above script checks for the existence of a special flag - MyEditorFlag. If the flag is not set, then the document.write call will not be executed. Of course, you need to define this flag on your page:
| var MyEditorFlag = true;
Since the IFRAME is considered as a different document, the flag will not be set there. Therefore, the script will only execute when it is not inside the editor content area (i.e. only in presentation mode). The only drawback from this approach is that if you click the "Preview" mode button in the editor, the script will not be executed, because it is still being considered inside the content area.
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed