Skip to content

Disable right click on shared file when hide download #29722

@leviia

Description

@leviia

Hello

It would be a great enhancement to prevent right click on shared file when "hide download" is on

It can be as simple as adding this js to the file apps/files_sharing/js/public.js

//prevent right-click when download is hidden
if (hideDownload === 'true') {
    document.addEventListener("contextmenu", function(e){
        e.preventDefault();
    }, false);
}

Or this code (using JQuery)

//prevent right-click when download is hidden
if (hideDownload === 'true') {
    $(document).on('contextmenu', function () {
        return false;
    });
}

I know the user is still able to bypass that but at least it is not that easy to download a file

I know also here we prevent the right click on the whole page (because of document), you can narrow it down to the exact div if you know which one).

At least it works

Has something like this a chance to be implemented in mainline ? So everyone will get this functionality.

All the best

Arnaud

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions