Browser & Web Performance · Junior · Question 60 of 75

Which way of putting user input into the page is safe from XSS?

Explanation

textContent treats the value as text, so <script> or <img onerror> are just characters, not markup.

Further reading

Problem with a question

Browser & Web Performance · Junior · question 60

Test yourself

Take the Browser & Web Performance · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz