Ingen beskrivning

read-local-file-api.html 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. ---
  2. title: "Reading a local file with the File API"
  3. layout: default
  4. section: example
  5. ---
  6. <ul class="nav nav-tabs" role="tablist">
  7. <li role="presentation" class="active">
  8. <a href="#load-result" aria-controls="load-result" role="tab" data-toggle="tab">
  9. result
  10. </a>
  11. </li>
  12. <li role="presentation">
  13. <a href="#load-js" aria-controls="load-js" role="tab" data-toggle="tab">
  14. js code
  15. </a>
  16. </li>
  17. <li role="presentation">
  18. <a href="#load-html" aria-controls="load-html" role="tab" data-toggle="tab">
  19. html code
  20. </a>
  21. </li>
  22. </ul>
  23. <div class="tab-content">
  24. <div role="tabpanel" class="tab-pane active" id="load-result">
  25. <div class="show-example">
  26. {% include_relative read-local-file-api.inc/read.html %}
  27. </div>
  28. </div>
  29. <div role="tabpanel" class="tab-pane" id="load-js">
  30. {% highlight js %}
  31. {% include_relative read-local-file-api.inc/read.js %}
  32. {% endhighlight %}
  33. </div>
  34. <div role="tabpanel" class="tab-pane" id="load-html">
  35. {% highlight html %}
  36. {% include_relative read-local-file-api.inc/read.html %}
  37. {% endhighlight %}
  38. </div>
  39. </div>
  40. <div id="error_block" class="alert alert-danger hidden">
  41. You will need a recent browser to use this demo :(
  42. </div>
  43. <script type="text/javascript">
  44. (function () {
  45. if (!window.FileReader || !window.ArrayBuffer) {
  46. $("#error_block").removeClass("hidden").addClass("show");
  47. return;
  48. }
  49. {% include_relative read-local-file-api.inc/read.js %}
  50. })();
  51. </script>