Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Feb 2008
    Posts
    111
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Need help with a Fallback solution

    I'm just getting started with a script that is a video gallery/slider that plays videos when you select the thumbnail image, but it doesn't play in IE8. I get this across the player screen:
    "Browser does not support the video tag", via IE8.

    I'm trying this:

    Code:
    <script>
    var ie = (function(){
        var undef,
            v = 3,
            div = document.createElement('div'),
            all = div.getElementsByTagName('i');
        while (
            div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
            all[0]
        );
        return v > 4 ? v : undef;
    });
    if (ie <9){
    //this is where you would load your fallback content
    but I need help with the next fallback part, which I can add to this post, if someone's interested in helping me.

    Thanks

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,470
    Thanks
    0
    Thanked 634 Times in 624 Posts
    You should be wrapping the video tag around an object tag that plays a flash version of the video for when the video tag isn't recognised.

    A video tag with all the fallbacks in place looks like this:

    Code:
    <video  width="300" height="200" poster="movie.jpg" controls>
            <source src='movie.mp4' type='video/mp4; codecs="avc1.4D401E, mp4a.40.2"'>
            <source src='movie.webm' type='video/webm; codecs="vp8.0, vorbis"'>
            <source src='movie.ogv' type='video/ogg; codecs="theora, vorbis"'>
            <object data="flashmovie.swf" width="300" height="200" type="application/x-shockwave-flash">
                  <param name="src" value="flashmovie.swf">
                  <param name="quality" value="high">
                  <param name="bgcolor" value="#FFFFFF">
                  <param name="wmode" value="transparent">
                  <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer">
                  <p>Fallback content for browsers that don't support either video or flash goes here.</p>
            </object> 
    </video>
    No JavaScript or conditional comments are required to apply a fallback for video as the HTML has two fallbacks built in.
    Last edited by felgall; 07-27-2013 at 10:52 PM.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •