Pen Settings



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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

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


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


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.


  Click the following button to initialise the file reader (eg. new FileReader)
  <button onclick="readerInit()">Initialize</button>
  Click the following button to load a file within the reader
  <button onclick="readFile()">Load File</button>
  Click the following button to trigger a file read and abort it
  <button onclick="readFileWithAbort()">Load File with abord</button>
  <table border="solid" id="eventTable">
     <td>Event Name</td>
     <td>FileReader State</td>
     <td>FileReader Result</td>





                var _reader;
const _file = new File(
  ["My newly created text file"], //fileContent
  "foo.txt",                      //fileName
  { type: "text/plain" }          //fileType
var table = document.getElementById('eventTable');

function readerInit(){
  _reader = new FileReader();
  printResult(_reader, "on initialization (new FileReader())");  
  _reader.onerror = (event) => printResult(, "onerror");  
  _reader.onabort = (event) => printResult(, "onabort");  
  _reader.onloadstart = (event) => printResult(, "onloadstart");  
  _reader.onloadend = (event) => printResult(, "onloadend");   
  _reader.onprogress = (event) => printResult(, "onprogress");  
  _reader.onload = (event) => printResult(, "onload");  

function readFile(event){

function readFileWithAbort(event){

function printResult(event, eventName){ 
  var row = table.insertRow();
  row.insertCell().innerHTML = eventName;
  row.insertCell().innerHTML = event.readyState;
  row.insertCell().innerHTML = event.result;