Skip to content

Commit 2cc8c14

Browse files
committed
v1.1.0
1 parent 50dc68f commit 2cc8c14

File tree

4 files changed

+375
-122
lines changed

4 files changed

+375
-122
lines changed

README.md

Lines changed: 68 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
12
# secure-web
23

3-
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.
4+
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.
5+
46

57
## Installation
68

79
Install the package via npm:
810

9-
```
11+
```bash
1012
npm install secure-web
1113
```
1214

@@ -17,7 +19,19 @@ Simply import the `noScreenshot` function from the `secure-web` package and call
1719
```javascript
1820
const noScreenshot = require('secure-web');
1921

20-
noScreenshot();
22+
noScreenshot({
23+
disableRightClick: true,
24+
disableKeyboardShortcuts: true,
25+
disableInspectElement: true,
26+
disablePrintScreen: true,
27+
disableScreenshot: true,
28+
disableFunctionKeys: true,
29+
disableCtrlF4: true,
30+
mouseLeave: true, // required for overlay with mouse leave a browser window
31+
ctrlOverlay: true,
32+
altOverlay: false, // must be pass true for overlay with Alt or Options key press
33+
shiftOverlay: false, // must be pass true for overlay with Shift key press
34+
});
2135
```
2236

2337
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.
@@ -29,39 +43,85 @@ This function will disable right-click, keyboard shortcuts, inspect element, pri
2943
<meta charset="UTF-8">
3044
<meta name="viewport" content="width=device-width, initial-scale=1.0">
3145
<title>Secure Web Page</title>
46+
<style link="stylesheet" href="path/to/secure-web.css"></style>
3247
<script src="node_modules/secure-web/dist/secure-web.js"></script>
3348
<!-- live link of package -->
3449
<script src="https://cdn.jsdelivr.net/npm/secure-web/dist/secure-web.js"></script>
3550
</head>
3651
<body>
3752
<script>
3853
window.onload = function() {
39-
noScreenshot();
54+
noScreenshot({
55+
altOverlay: true,
56+
shiftOverlay: true,
57+
});
4058
};
4159
</script>
4260
</body>
4361
</html>
4462
```
4563

64+
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.
65+
66+
## Options
67+
68+
The `noScreenshot` function accepts the following options:
69+
70+
- `disableRightClick`: Disables right-clicking on the web page.
71+
- `disableKeyboardShortcuts`: Disables keyboard shortcuts such as Ctrl+C, Ctrl+U, etc.
72+
- `disableInspectElement`: Disables the inspect element functionality.
73+
- `disablePrintScreen`: Disables the print screen functionality.
74+
- `disableScreenshot`: Disables taking screenshots using various methods.
75+
- `disableFunctionKeys`: Disables function keys (F1-F12).
76+
- `disableCtrlF4`: Disables the Ctrl+F4 key combination.
77+
- `mouseLeave`: Activates overlay when cursor leaves the window.
78+
- `ctrlOverlay`: Activates overlay when Ctrl or Command key is pressed.
79+
- `altOverlay`: Activates overlay when Alt or Options key is pressed.
80+
- `shiftOverlay`: Activates overlay when Shift key is pressed.
81+
4682
## Example
4783

4884
```javascript
4985
const noScreenshot = require('secure-web');
5086

5187
window.onload = function() {
52-
noScreenshot();
88+
noScreenshot({
89+
disableRightClick: true,
90+
disableKeyboardShortcuts: true,
91+
disableInspectElement: true,
92+
disablePrintScreen: true,
93+
disableScreenshot: true,
94+
disableFunctionKeys: true,
95+
disableCtrlF4: true,
96+
mouseLeave: true,
97+
ctrlOverlay: true,
98+
altOverlay: true,
99+
shiftOverlay: true,
100+
});
53101
};
54102
```
55103

56104
## API
57105

58-
### noScreenshot()
106+
### noScreenshot(options)
107+
108+
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:
59109

60-
The `noScreenshot` function disables various methods of taking screenshots and overlays a message on the screen indicating that screenshots are disabled.
110+
- `disableRightClick`
111+
- `disableKeyboardShortcuts`
112+
- `disableInspectElement`
113+
- `disablePrintScreen`
114+
- `disableScreenshot`
115+
- `disableFunctionKeys`
116+
- `disableCtrlF4`
117+
- `mouseLeave`
118+
- `ctrlOverlay`
119+
- `altOverlay`
120+
- `shiftOverlay`
61121

62122
## License
63123

64124
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
65125
```
66126
67-
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.
127+
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.

0 commit comments

Comments
 (0)