restrict screenshot

How to restrict screenshot for both mobile and web?

I have used the javascript for web application on keypress function, but it is not working

SyntaxEditor Code Snippet

function print()
{
if(event.charCode==44)
{
    return false;
}
}

Hi Ellakkiya,

One possibility is to do it with CSS. Check out this link how to achieve it.

Sam

Hi Ellakkiya Selvadurai,

In case is possible for you, try this CSS code to hide page on print:

@media print {
    html, body {
       display: none;
    }
}

Regards,



Marco Arede wrote:

Hi Ellakkiya Selvadurai,

In case is possible for you, try this CSS code to hide page on print:

@media print {
    html, body {
       display: none;
    }
}

Regards,



Thankyou for reply Sam Rijkers and Marco Arede,

I have tried with this css but it is not working.


Ellakkiya Selvadurai wrote:

How to restrict screenshot for both mobile and web?

I have used the javascript for web application on keypress function, but it is not working

SyntaxEditor Code Snippet

function print()
{
if(event.charCode==44)
{
    return false;
}
}

Hi Ellakkiya,


Web pages can not control all or part of the client PC for security reasons & The Print-screen button is handled by the OS of the client PC. By default it is even not passed to running applications like a web browser. The only solution is to let an application hook the keyboard input using an OS specific method. But such is not supported by JavaScript.

Even with the normal MVC framework of PHP or Node it is quite impossible to do so.

-----------------------------------------------------------------


@media print {
    html, body {
       display: none;  /* hide whole page */
    }
}

This will work with print command but not with "print screen"!

And I am pretty sure there's no way to achieve that, as of  Print screen is a part of the OS, not the browser.

Thanks





assif_tiger wrote:

Ellakkiya Selvadurai wrote:

How to restrict screenshot for both mobile and web?

I have used the javascript for web application on keypress function, but it is not working

SyntaxEditor Code Snippet

function print()
{
if(event.charCode==44)
{
    return false;
}
}

Hi Ellakkiya,


Web pages can not control all or part of the client PC for security reasons & The Print-screen button is handled by the OS of the client PC. By default it is even not passed to running applications like a web browser. The only solution is to let an application hook the keyboard input using an OS specific method. But such is not supported by JavaScript.

Even with the normal MVC framework of PHP or Node it is quite impossible to do so.

-----------------------------------------------------------------


@media print {
    html, body {
       display: none;  /* hide whole page */
    }
}

This will work with print command but not with "print screen"!

And I am pretty sure there's no way to achieve that, as of  Print screen is a part of the OS, not the browser.

Thanks





Thankyou for your reply assif_tiger