This content originally appeared on Modern Web Development with Chrome and was authored by Paul Kinlan
<p>Jason did an amazing talk about a little-known but new area of the web platform 'Feature Policy'.</p>
<blockquote>
<p>Feature Policy is a new primitive which allows developers to selectively enable, disable, and modify the behaviour of certain APIs and features in the browser. It's like CSP, but for features & APIs! Teams can use new tools like Feature Policy and the Reporting API to catch errors before they grow out of control, ensure site performance stays high, keep code quality healthy, and help avoid the web's biggest footguns.</p>
<p>Check out <a href="https://featurepolicy.rocks">featurepolicy.rocks</a> for more information about Feature Policy, code samples, and live demos.</p>
<p>Submit new ideas for policies or feedback on existing policies at → <a href="https://bit.ly/2B3gDEU">https://bit.ly/2B3gDEU</a>.</p>
<p>To learn more about the Reporting API see <a href="https://bit.ly/rep-api">https://bit.ly/rep-api</a>.</p>
</blockquote>
<p><a href="https://www.youtube.com/watch?v=igHvSUrLqXc&list=PLNYkxOF6rcIDjlCx1PcphPpmf43aKOAdF&t=0s&index=14">Read full post</a>.</p>
<p>Feature policy is an interesting area that can seem like a hard place to work out where.</p>
<p>There are a couple of areas where I seeing it being beneficial:</p>
<ol>
<li><strong>Control 3rd-party content</strong>. As an embedder, you should be able to control what functionality runs in the context of your page and when it runs. Feature policy gives you that control. Don't want iframes to autoplay video? Turn it off. Don't want third party iframes to request geo-location? Turn it off. Don't want iframes to access sensor information? Turn it off. You should be in control of your experience, not third party sites.</li>
<li><strong>Stay on target in development</strong>. We talked a lot at Chrome DevSummit about perf-budgets, yet today they can be hard to reason with. Feature Policy enabled on your development and staging services will help you know if any sets of changes you are making will breach your performance budgets by stopping you from doing the wrong thing. A case in point, our very own Chrome Dev Summit side had feature policy enabled for images called 'max-downscaling-image' - it inverts the colour of the image when it has been downscaled too much (a large image displayed in a small container). Feature policy picked it up and enabled us to make a decision about what to do. In the end, we disabled the policy because we were using the larger version of the image in multiple places and the images were already cached at that point.</li>
</ol>
<p>I do encourage you all to look in to feature policy a lot more because it will play an important part of the future of the web. If you want to see the latest Policies that Chrome is implementing then checkout <a href="https://www.chromestatus.com/features#feature%20policy">Feature Policy on Chrome Status</a></p>
This content originally appeared on Modern Web Development with Chrome and was authored by Paul Kinlan