This is a simple example project that demonstrates how Cross-Site Scripting (XSS) works and how to prevent this type of attack. The project uses pure JavaScript, HTML, and Tailwind CSS.
-
Clone the repository to your local machine using
git clone
command or by downloading the ZIP file from the repository. -
Setup project and run development server
Download Node.js. Run this followed commands:
With yarn
# Install dependencies (only the first time)
yarn
# Run the local server at localhost:5173
yarn dev
With NPM
# Install dependencies (only the first time)
npm install
# Run the local server at localhost:5173
npm run dev
- Launch the project in your web browser.
- Follow the instructions in xss.js to understand how XSS attacks work and how they can be prevented.
- Experiment with different types of XSS attacks and see the countermeasures in action.
- Explore the code in the
index.html
andxss.js
files to understand the implementation of the XSS prevention techniques using pure JavaScript.
If you would like to contribute to this project, please fork the repository, make your changes, and submit a pull request.
This project is open-source and available under the MIT License.
This project was created by Bohdan Ly. Feel free to contact me at bohdan.lysh@gmail.com for any questions or feedback.
Enjoy exploring and learning about XSS attacks and their prevention in this example project!