SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2002
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Flash and Browser Detect

    This is two questions.

    1st: How do I replace a Flash image/banner with a gif/jpg if the user doesn't have the proper pluggin
    &
    2nd: Does anyone have a good broswer & browser version detection script? I need something that would allow me to check the browser type and version, and then modify postion of <div> since all browsers do a such fantastic job of consistently placing them in the same place

    Many Thanks
    NOEINK
    <Think Without Ink>

  2. #2
    ...
    Join Date
    Jan 2002
    Location
    London, UK
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here's a good Flash version detection script....

    http://www.sitepointforums.com/showt...threadid=84114

    there's a good browser type sniffer here.....

    http://www.mozilla.org/docs/web-deve...wser_type.html

  3. #3
    SitePoint Addict
    Join Date
    Apr 2002
    Location
    Whitehorse, Yukon
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This modified MM script works in all browsers I've tested it on, including mac + windows in IE, NS, Opera, Safari, Camino, Mozilla.

    It first checks for the Flash plug-in, and if it doesn't find the player, loads the file that you specify. Simply replace the "movie.swf" with your movie, any missing dimensions (shown by "?") and the "image.jpg" with your image.

    <SCRIPT LANGUAGE=JavaScript1.1>
    <!--
    var MM_contentVersion = 4;
    var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
    if ( plugin ) {
    var words = navigator.plugins["Shockwave Flash"].description.split(" ");
    for (var i = 0; i < words.length; ++i)
    {
    if (isNaN(parseInt(words[i])))
    continue;
    var MM_PluginVersion = words[i];
    }
    var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
    }
    else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
    && (navigator.appVersion.indexOf("Win") != -1)) {
    document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
    document.write('on error resume next \n');
    document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
    document.write('</SCR' + 'IPT\> \n');
    }
    if ( MM_FlashCanPlay ) {
    document.write('<OBJECT classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000"');
    document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
    document.write(' ID="title" WIDTH="?" HEIGHT="?" ALIGN="">');
    document.write(' <PARAM NAME=movie VALUE="movie.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#?> ');
    document.write(' <EMBED src="movie.swf" quality=high bgcolor=#? ');
    document.write(' swLiveConnect=FALSE WIDTH="?" HEIGHT="?" NAME="test" ALIGN=""');
    document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
    document.write(' </EMBED>');
    document.write(' </OBJECT>');
    } else{
    document.write('<IMG SRC="image.jpg" WIDTH="?" HEIGHT="?" usemap="#test" BORDER=0>');
    }
    //-->
    </SCRIPT>
    <NOSCRIPT>
    <IMG SRC="image.jpg" WIDTH="?" HEIGH="?" BORDER=0>
    </NOSCRIPT>

    --

    Pardon the capitalized code I just copied and pasted this from an older site we'd done...

    geof

  4. #4
    ...
    Join Date
    Jan 2002
    Location
    London, UK
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If im not mistaken that script's identical to the one i posted above, so there's no modification to the original MM JavaScript?

  5. #5
    SitePoint Addict
    Join Date
    Apr 2002
    Location
    Whitehorse, Yukon
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Chas,

    It may be identical to what you have posted. We had it on a couple of our sites, and I never really looked at the code until today. The guy I was working with just used it on the fly...being who he is, I just assumed that he'd modified it, because he's always tweaking and customizing scripts. In this case, I guess not!

    Sorry. I apologize for any confusion.

    geof

  6. #6
    ...
    Join Date
    Jan 2002
    Location
    London, UK
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Geof,

    no need to apologize


Bookmarks

Posting Permissions

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