npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

secure-web

v1.2.0

Published

Secure-Web is an npm package that prevents users from taking screenshots of your web page by securing it against various methods of screenshot capture. With customizable options to tailor the security measures according to your needs, Secure-Web ensures t

Downloads

180

Readme

secure-web

secure-web is an npm package that prevents users from taking screenshots of your web page by securing it against various methods of screenshot capture. It provides customizable options to tailor the security measures according to your needs.

Installation

Install the package via npm:

npm install secure-web

Usage

Simply import the noScreenshot function from the secure-web package and call it in your JavaScript code:

const noScreenshot = require('secure-web');

noScreenshot({
    disableRightClick: true,
    disableKeyboardShortcuts: true,
    disableInspectElement: true,
    disablePrintScreen: true,
    disableScreenshot: true,
    disableFunctionKeys: true,
    disableCtrlF4: true,
    mouseLeave: true, // required for overlay with mouse leave a browser window
    mouseEnterAutoHide: false, // required for auto hide overlay with mouse enter a browser window
    ctrlOverlay: true, 
    altOverlay: false, // must be pass true for overlay with Alt or Options key press
    shiftOverlay: false, // must be pass true for overlay with Shift key press
} , 'custom-overlay-id');

This function will disable right-click, keyboard shortcuts, inspect element, print screen, and various other methods commonly used for taking screenshots. Additionally, it will overlay a message on the screen indicating that screenshots are disabled.

Make sure to replace "custom-overlay-id" with the ID of the custom overlay you want to use, or omit it to use the default overlay.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Secure Web Page</title>
    <style link="stylesheet" href="path/to/secure-web.css"></style>
    <script src="node_modules/secure-web/dist/secure-web.js"></script>
<!--    live link of package -->
    <script src="https://cdn.jsdelivr.net/npm/secure-web/dist/secure-web.js"></script>
</head>
<body>
    <script>
        window.onload = function() {
            noScreenshot({
                altOverlay: true,
                shiftOverlay: true,
            });
        };
    </script>
</body>
</html>

Make sure to replace "path/to/secure-web.js" in the example HTML with the actual path to your secure-web.js file. Also, customize the installation, usage, example, and API sections as necessary for your package.

Options

The noScreenshot function accepts the following options:

  • disableRightClick: Disables right-clicking on the web page.
  • disableKeyboardShortcuts: Disables keyboard shortcuts such as Ctrl+C, Ctrl+U, etc.
  • disableInspectElement: Disables the inspect element functionality.
  • disablePrintScreen: Disables the print screen functionality.
  • disableScreenshot: Disables taking screenshots using various methods.
  • disableFunctionKeys: Disables function keys (F1-F12).
  • disableCtrlF4: Disables the Ctrl+F4 key combination.
  • mouseLeave: Activates overlay when cursor leaves the window.
  • mouseEnterAutoHide: Activates overlay when cursor enters the window.
  • ctrlOverlay: Activates overlay when Ctrl or Command key is pressed.
  • altOverlay: Activates overlay when Alt or Options key is pressed.
  • shiftOverlay: Activates overlay when Shift key is pressed.

Example

const noScreenshot = require('secure-web');

window.onload = function() {
    noScreenshot({
        disableRightClick: true,
        disableKeyboardShortcuts: true,
        disableInspectElement: true,
        disablePrintScreen: true,
        disableScreenshot: true,
        disableFunctionKeys: true,
        disableCtrlF4: true,
        mouseLeave: true,
        mouseEnterAutoHide: false,
        ctrlOverlay: true,
        altOverlay: true,
        shiftOverlay: true,
    } , 'custom-overlay-id');
};

API

noScreenshot(options)

The noScreenshot function disables various methods of taking screenshots and overlays a message on the screen indicating that screenshots are disabled. It accepts an options object with the following properties:

  • disableRightClick
  • disableKeyboardShortcuts
  • disableInspectElement
  • disablePrintScreen
  • disableScreenshot
  • disableFunctionKeys
  • disableCtrlF4
  • mouseLeave
  • mouseEnterAutoHide
  • ctrlOverlay
  • altOverlay
  • shiftOverlay
  • overlayId: Optional parameter to specify the ID of a custom overlay to use instead of the default one.

License

This project is licensed under the MIT License - see the LICENSE file for details.


This README now includes a section detailing the available options for the `noScreenshot` function, providing users with a clear understanding of how they can customize the behavior of the package.