You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
+
4
6
5
7
## Installation
6
8
7
9
Install the package via npm:
8
10
9
-
```
11
+
```bash
10
12
npm install secure-web
11
13
```
12
14
@@ -17,7 +19,19 @@ Simply import the `noScreenshot` function from the `secure-web` package and call
17
19
```javascript
18
20
constnoScreenshot=require('secure-web');
19
21
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
+
});
21
35
```
22
36
23
37
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
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
+
46
82
## Example
47
83
48
84
```javascript
49
85
constnoScreenshot=require('secure-web');
50
86
51
87
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
+
});
53
101
};
54
102
```
55
103
56
104
## API
57
105
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:
59
109
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`
61
121
62
122
## License
63
123
64
124
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
65
125
```
66
126
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