Permissions-Policy and Feature Control
You'll learn how to control which browser features and APIs your site (and embedded content) can access.
What Is Permissions-Policy?
Modern browsers offer powerful APIs: geolocation, camera, microphone, payment handlers, fullscreen mode, and more. While useful, these features pose security and privacy risks—especially when third-party scripts or iframes run on your page. Permissions-Policy (formerly called Feature-Policy) lets you explicitly restrict which features your site and embedded content can use.
Think of it like permission slips in school: you decide which activities (features) your site and its "guests" (iframes, scripts) are allowed to participate in. By default, deny everything unnecessary; grant only what's needed.
How It Works
You configure Permissions-Policy via an HTTP response header:
Permissions-Policy: geolocation=(), camera=(self), microphone=(self "https://trusted.com")
This means:
geolocation=(): Nobody can access geolocation (not even your own site)camera=(self): Only your origin can use the cameramicrophone=(self "https://trusted.com"): Your origin andtrusted.comcan access the microphone
You can also set it via an iframe allow attribute:
<iframe src="https://partner.com" allow="microphone 'src'"></iframe>
Why Use It?
Security and privacy: Prevent malicious or compromised third-party scripts from silently accessing sensitive APIs. Even if an attacker injects code, the browser enforces your policy.
User trust: Visitors feel safer knowing your site minimizes unnecessary permission requests.
Defense in depth: Works alongside CSP to lock down browser capabilities.
Key Takeaway:
Permissions-Policy restricts which powerful browser features your site and embedded content can access, reducing attack surface and protecting user privacy by denying capabilities you don't explicitly need.