Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Dustin Lammiman

    (@nosecreek)

    The reason the script is loaded in the header is that it contains an HTML5 Shim for support in older browsers. If your theme or another plugin is already using a shim, you can safely move the script to the footer. Unfortunately we have no way of knowing this, so the script is always loaded in the header to ensure full compatibility.

    Thread Starter marcelstoer

    (@marcelstoer)

    Hhmm, if that’s the only reason why aren’t there two scripts then? “Separation of concerns” comes to mind…

    Plugin Author Dustin Lammiman

    (@nosecreek)

    I only maintain the plugin, not Video.js itself, so you’d have to ask the makers of the script. It does make sense to me though – the purpose of Video.js is to ensure that HTML5 Video works in a consistent fasion across all browsers. Having a shim to make the video tag work in older browsers deffinitely fits that purpose.

    Thread Starter marcelstoer

    (@marcelstoer)

    Just include the shim in the head and the script at the end of the body:

    https://github.com/mmcc/video.js/blob/da3550a6d83c6b60379e24df06cb805993bbb01a/docs/setup.md

    If you’re not using something like Modernizr but still want to include Video.JS before the closing body tag, you can simply add your own shiv. Simply include this in the head of your document:

    <script type="text/javascript">
      document.createElement('video');document.createElement('audio');
    </script>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Move JavaScript to the bottom – please…’ is closed to new replies.