Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                <html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Simple Feature Policy Reporting</title>
</head>
<body>
  <h1>Feature Policy Reporting Demo</h1>
  <p>A quick and dirty example of how you could watch for Feature Policy violations using a ReportingObserver, and then display them prominently on the page to make them visible.</p>
  <p>To see the Feature Policies in action, you'll need to:</p>
  <ol>
    <li>Be using a Blink-based browser</li>
    <li>Have Experimental Web Platform Features enabled (about:flags)</li>
    <li>Enable a Feature-Policy header (<code>unsized-media</code> and <code>oversized-images</code> should do the trick) somehow (I like <a href="https://chrome.google.com/webstore/detail/modheader/idgpnmonknjnojddfkpgkljpfnnfcklj?hl=en">ModHeader</a>)</li>
  </ol>
  <img src="https://via.placeholder.com/300" alt="">
  <img src="https://via.placeholder.com/600" width="100" alt="">

</body>
</html>
              
            
!

CSS

              
                body {
  padding-bottom: 0;
  font: 100%/1.4em Helvetica, Arial, sans-serif;
}
#reportingAlerts{
  background: #282828;
  color: #fff;
  padding: 1em;
  border-top: 5px solid #da1e28;
  position: fixed;
  top: 1em;
  right: 1em;
  padding: 1em;
  list-style: none;
}
#reportingAlerts li+li{
  margin-top: 1em;
}
#reportingAlerts li:before{
  content: 'x';
  color: #fff;
  background: #da1e28;
  border-radius: 50%;
  padding: .3em .6em;
  line-height: 1em;
  margin-right: .5em;
}
              
            
!

JS

              
                let reportingAlerts = document.createElement('ul');
  reportingAlerts.setAttribute('id','reportingAlerts');
  document.body.appendChild(reportingAlerts);

const alertBox = document.getElementById('reportingAlerts');

new ReportingObserver((reports, observer) => {
  let fragment = document.createDocumentFragment();
  
  Object.keys(reports).forEach(function(item) {
    let li = document.createElement('li');
    li.textContent = reports[item].body.message + ': ' + reports[item].body.featureId;
    fragment.appendChild(li);
  });
  
  alertBox.appendChild(fragment)
}, {types: ['feature-policy-violation'], buffered: true}).observe();
              
            
!
999px

Console