Any way to prevent Ctrl+V in Chrome?

2 posts, 0 answers
  1. Graham
    Graham avatar
    4 posts
    Member since:
    May 2011

    Posted 07 Feb 2012 Link to this post

    I'm working on a project where they want us to prevent any of the users from pasting into the RadEditor, and I was able to get it working in IE and Firefox (finally), but Chrome just lets me paste right into the box and I cant seem to make it stop. The JavaScript I am using to prevent Pasting is as follows.

    <script type="text/javascript" language="javascript">
        // Prevents pasting into RadEditor
        // from RadEditor menu and Context menu
        function OnClientCommandExecuting(editor, args) {
            var commandName = args.get_commandName();
            if (commandName == "PasteFromWord"
            || commandName == "PasteFromWordNoFontsNoSizes"
            || commandName == "PastePlainText"
            || commandName == "PasteAsHtml"
            || commandName == "Paste") {
        // Prevents pasting into RadEditor
        // by pressing Ctrl + V
        function OnClientLoad(editor) {
            editor.attachEventHandler("onkeydown", function (e) {
                if (e.ctrlKey && e.keyCode == 86) {
                    if (document.all) {
                        e.cancelbubble = true;
                        e.returnvalue = false;
                        return false;
                    else {
                        return false;
            // Prevents Firefox from loading the context menu.
            editor.attachEventHandler("oncontextmenu", function (e) {
                if (e.preventDefault) e.preventDefault();
                if (e.stopPropagation) e.stopPropagation();
                return false;
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Feb 2012 Link to this post

    Hello Graham,

    Check the following forum thread which discussed similar scenario.
    How to block all CTRL+V Operations in Editor.

Back to Top