0

We are using ckeditor inline edit in our asp.net mvc application. It removes the script tag when rendering the content. Following is the script we are trying to add in the source mode and save it to the database:

<script type="text/javascript" language="javascript">
        $(function() {
              document.oncontextmenu = function() { alert('Right click disabled for security reasons!!') ;return false;}
       });
   </script>

It adds fine to the database and when rendering the content back to the webpage, it removes the script tag.

Below is the image where I was able to add the script and save:

enter image description here

Below is the image where it removed the script when rendering back the page after save:

enter image description here

Following is the code i am using in my page to render the saved content:

<div id="content_editable" contenteditable="true">@Html.Raw(Model.PageContent.ToString())</div>

enter image description here

When i remove Html.Raw, it displays the script as the text in the page, but I need to have the script only in the source mode. I also have allowedContent = true in my config.js of ckeditor.

Please suggest how to handle this?

4

0 回答 0