This is a migrated thread and some comments may be shown as answers.
Allow inserting JavaScript?
1 Answer 7 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mike
Top achievements
Rank 1
Mike asked on 04 Jan 2012, 06:22 PM
Greetings,

Is it possible to allow the Editor to accept JavaScript? My script tags seem to be getting stripped out.

I found this for the classic ASP.NET editor, couldn't find a similar method for MVC - http://www.telerik.com/community/forums/aspnet/editor/radeditor-removes-javascript-code.aspx

Thanks,
Mike

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 05 Jan 2012, 01:28 PM
Hi Mike,

If I understand your question correctly you need to encode the text (so you actually see the tags of the script) before you pass it as Value to the editor.
To do so you can encode the string using the Server.HtmlEncode() method provided by ASP.NET.
e.g.
@(Html.Telerik().Editor()
    .Name("Editor")
    .Value(Server.HtmlEncode("<script>alert('hello')</script>world"))
)

If this is not your case please give an example what you are trying to achieve.

All the best,
Petur Subev
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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Editor
Asked by
Mike
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or