Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8211619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:29:15+00:00 2026-06-07T10:29:15+00:00

I have registered javascript under portal_javascript using the answer 1 from How to Disable

  • 0

I have registered javascript under portal_javascript using the answer 1 from How to Disable Copy Paste (Browser)
steps I followed: 1> copied the script in a file

document.onkeydown = function(e) {
    if (e.ctrlKey && e.keyCode === 65) {
   //     alert('not allowed');
        return false;
    }
     if (e.ctrlKey && e.keyCode === 67) {
     //   alert('not allowed');
        return false; 
    }
     if (e.ctrlKey && e.keyCode === 86) {
       // alert('not allowed');
        return false;
    }
};​
document.oncontextmenu=new Function("return false")

Step 2)Selected portal_javascripts /added this script with just the same id/url under development mode and saved.
3.In the atreal.richfile.preview customize the template (atreal.richfile.preview.interfaces.ipreview-atreal.richfile.preview.viewlet) by setting the mouse buttons events onSelectStart and onSelectDrag to False. Change the code by removing the right top buttons of the preview window and also displaying files other than pdf in this window. Use the code block as :

<dl class="richfile portlet"
    tal:condition="view/available"
    tal:attributes="id view/plugin_id"
    i18n:domain="atreal.richfile.preview">

    <dt tal:attributes="id string:${view/plugin_id}Header" class="rfheader portletHeader">
        <span class="portletTopLeft"></span>
        <!--tal:block tal:replace="structure view/controls"-->
        <span class="title" style="font-weight:bold"
            i18n:translate="">
            Preview
        </span>

        <span class="portletTopRight" ></span>
    </dt>

        <!--Your specific code here      tal:condition="not:ispdf" -->        
    <dd>
        <tal:block define="ispdf python:here.absolute_url().endswith('.pdf')">
        <IFRAME src="http://www.xyz.com" 
                    tal:condition="not:ispdf"
            tal:attributes="src string:${here/absolute_url}/rfpreview"
            width="100%" height="400" scrolling="auto" frameborder="1"> 
                    draggable="false" onselectstart="false"
           </IFRAME>  
    </tal:block>
    </dd>   
</dl>
  1. In ZMI, portal_types/File select Aliases tab and change the methods to (selected layout) for both Default and View Aliases and save.
  2. IN ZMI, portal_skins/archetypes customize at_download code to return nothing or rather deleted the code there.
  3. Use the add-on collective.documentviewer to preview pdf files.
    This works fine for me. I have been persueing this problem past 1 1/2 month. Finally I am happy with the end result. Thought of sharing with you all. 🙂
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:29:17+00:00Added an answer on June 7, 2026 at 10:29 am

    Try this to prevent default behaviour.

    document.onkeydown = function(e) {
        if (e.ctrlKey && e.keyCode === 65) {
            alert('not allowed');
        }
         if (e.ctrlKey && e.keyCode === 67) {
            alert('not allowed');
        }
         if (e.ctrlKey && e.keyCode === 86) {
            alert('not allowed');
        }
    
        return false;
    };​
    

    *DEMO* Test on the result window, not anywhere else.

    UPDATE To disable right-click

    <SCRIPT TYPE="text/javascript"> 
    <!-- 
    //Disable right click script 
    //visit http://www.rainbow.arch.scriptmania.com/scripts/ 
    var message="Sorry, right-click has been disabled"; 
    /////////////////////////////////// 
    function clickIE() {if (document.all) {(message);return false;}} 
    function clickNS(e) {if 
    (document.layers||(document.getElementById&&!document.all)) { 
    if (e.which==2||e.which==3) {(message);return false;}}} 
    if (document.layers) 
    {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} 
    else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} 
    document.oncontextmenu=new Function("return false") 
    // --> 
    </SCRIPT> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a android application using phonegap. I have registered certain recievers which
I am using the MVP design pattern and I have registered my presenter as
In my Zope instance, I have a Python script registered as a browser page.
I have some troubles when using javascript code for Facebook invite friends. Details: User
I have created a webservice and want to call it from javascript , for
I Have usercontrol and i registered the following javascript method in code behind :
I have installed nodejs, installed coffee using npm and registered the environment variables and
I have Javascript that opens another window and registers a click handler for all
I have some Javascript code that will programmatically register an COM interop assembly by
I have registered an enumeration type ClefType within my header file - this enum

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.