Skip to main content
InterviewHubPRO
Section Overview
Q11

Question 11 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

22%
HTML5 & Web APIs (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

What are HTML entities and why must user inputs be escaped?

junior LevelhtmlBasic

In Simple Words: In HTML, characters like < and > are reserved for tag syntax.

  • If a user submits a comment containing <script>alert('hacked')</script> and you render it unescaped, the browser interprets it as executable code (Cross-Site Scripting - XSS).
  • HTML Entities encode reserved characters into safe character entities:
    • < -> &lt;
    • > -> &gt;
    • & -> &amp;
    • " -> &quot;
    • ' -> &#x27;