     warn 'Cannot read from local file system.
           Loaded from browser DOM instead.'
     value = document.documentElement.outerHTML
+    value = value.replace /^<html>.*<body>/, ''  # Remove auto-inserted tags
 
   editor = document.getElementById 'editor'
   codemirror = CodeMirror editor, options =

    if location.protocol isnt 'file:'
      msg += '<li>Open from your local computer'

    if msg then warn "Some features may not be available.
                      (Did you know this file can save itself?)<br>
                      To ensure full functionality:<br>
                      <ol class=table-list>#{msg}</ol>"

noticeContainer = document.createElement 'div'
noticeContainer.className = 'notices'

# No localStorage in IE from file:/// protocol
if window.localStorage
    window.localData = window.localStorage
else
    window.localData = {}
    error 'No localStorage. All changes will be lost!'

loadFileReady = () ->
  constructHelpText()

  value = ''
  if window.mozillaLoadFile
    if localData.value
      inform "Found data to transfer from browser local storage..."
      saveContents localData.value
      value = localData.value
      delete localData.value
    else
      inform "Loaded from #{path}."
      value = window.mozillaLoadFile path
  else if localData.value
    warn 'Cannot read from local file system.
          Loaded from browser local storage instead.'
    value = localData.value
    window.documentWritten ?= false
    if not window.documentWritten
      document.write value
