Skip to main content
InterviewHubPRO
Section Overview
Q23

Question 23 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

46%
HTML5 & Web APIs (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

What are `iframe` security attributes (`sandbox`, `allow`, `referrerpolicy`)?

senior LevelCode ExampleSecurity & AuthSystem Design

In Simple Words: Embedding untrusted third-party content (ads, widgets) introduces security vulnerabilities:

  • sandbox: Implements extreme restrictions by default (blocks scripts, forms, popups, top-navigation):
    html
    <iframe src="https://untrusted.com"
            sandbox="allow-scripts allow-forms"
            referrerpolicy="no-referrer"></iframe>
    
  • allow="camera 'none'; microphone 'none'": Permissions Policy attribute controlling access to hardware sensors.