https://github.com/adityavijay21/copyinterceptor
A React component to block text copying and notify users with a toast message.
https://github.com/adityavijay21/copyinterceptor
clipboard-blocker copy-prevention react react-components react-toastify toast-notifications
Last synced: about 1 month ago
JSON representation
A React component to block text copying and notify users with a toast message.
- Host: GitHub
- URL: https://github.com/adityavijay21/copyinterceptor
- Owner: adityavijay21
- Created: 2024-11-29T04:42:31.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-12-06T02:48:28.000Z (6 months ago)
- Last Synced: 2025-03-25T05:35:16.578Z (2 months ago)
- Topics: clipboard-blocker, copy-prevention, react, react-components, react-toastify, toast-notifications
- Language: JavaScript
- Homepage: https://copyinterceptor.onrender.com/
- Size: 352 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CopyInterceptor
CopyInterceptor is a React component designed to prevent users from copying text on your website. It intercepts copy events and displays a toast notification using `react-toastify`.
## Features
- **Restricts Copying**: Prevents users from copying content on your webpage.
- **Toast Notification**: Displays a notification whenever a copy attempt is made.
- **User-Friendly**: Built with `react-toastify` for smooth and customizable notifications.## How It Works
The component listens for the `copy` event on the document. When triggered, it prevents the default copy action and shows a toast notification informing the user that copying is restricted.
## Setup
### Prerequisites
Make sure you have React and `react-toastify` installed in your project:
```bash
npm install react-toastify
```### Installation
Download or clone this repository:
```bash
git clone https://github.com/adityavijay21/copy-text-interceptor.git
```### Usage
Include the `CopyTextInterceptor` component in your project:
```jsx
import React from 'react';
import CopyTextInterceptor from './CopyTextInterceptor';const App = () => (
Welcome to My Website
This is some text that users cannot copy!
);export default App;
```## Customization
The toast notification uses `react-toastify`. You can customize its appearance by modifying the toast settings in the component.
## Contributing
Contributions are welcome! Feel free to fork the repository, open issues, or submit pull requests to enhance functionality or fix bugs.
## License
This project is licensed under the [MIT License](LICENSE).