XSS
Learn how to prevent Cross-Site Scripting (XSS) attacks with examples and best practices. Protect your application from XSS vulnerabilities and security threats.
Tools recognizing this:
What is Cross-Site Scripting
One Simple Example
// Fetch 'userName' parameter from the URL
var urlParams = new URLSearchParams(window.location.search);var userName = urlParams.get('userName');
// Post it back as HTML
document.getElementById("welcome").innerHTML = "Welcome " + userName;Real-world Occurrences of XSS
Twitter XSS Worm (2010)
MySpace Samy Worm (2005)
Fixing Cross-Site Scripting
Code Samples
Last updated