title: Sharepoint and Microsoft Teams can't Preview HTML file in HTML File Viewer
body: <p>I have some small HTML files (containing interactive data visualizations made in R/Python). They can't be published online but I thought I could upload them to Sharepoint/Teams and preview them in the HTML File Viewer to share with my colleagues.</p>
  <p>Unfortunately, none of the files can be previewed as the JavaScript does not run. Is this the intended behavior of <code>html file preview</code> in Teams and Sharepoint?</p>
  <p>As an example, the HTML file below produces the following preview in both Teams and Sharepoint.</p>
  <p>Is there a way to default this file to <code>Open in Browser</code> rather than <code>preview</code>? or make it so the JavaScript does run?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  
  &lt;p id="demo"&gt;Javascript is not working&lt;/p&gt;
  
  &lt;script&gt;
    document.getElementById("demo").innerHTML = "Hello JavaScript!";
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  <p><a href="https://i.stack.imgur.com/5f4vq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5f4vq.png" alt="enter image description here" /></a></p>