🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: XSS: all 10 questions

Quiz: XSS · Question 2 of 10

What is the main fix for XSS?

What is the main fix for XSS?

  1. A.Remove the word "script" from input
  2. B.Encode output for its context (e.g. HTML-escape < > & " ')
  3. C.Use HTTPS
  4. D.Use POST instead of GET
Answer & explanation

Correct answer: Encode output for its context (e.g. HTML-escape < > & " ')

Context-aware output encoding makes the browser treat data as text. Keyword filters are easy to bypass.

Can you get the rest right without peeking?

Take the timed Quiz: XSS quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →