Results 1 to 4 of 4

Thread: Flash detection in Javascript

  1. #1

    Flash detection in Javascript

    Hi people.
    Hi. I have done the javascript /flash detection tutorial that displays an image if the user has no player. It works, except the image that displays appears at the top of the screen, and I need it to appear in the bottom right. Suspect its because the javascript is in a head tag. Any ideas?

    I was told by someone I work with that that I have to "put it in a function and then call the function where I want the image to appear". But I'm not sure on which line put the 'function { ' or how to call it. and am too embarassed to ask.

    Any help would be very much appreciated.

    EDIT: This is the code Im using:

    <SCRIPT LANGUAGE=JavaScript1.1>
    <!--
    function detect_flash {
    var MM_contentVersion = 6;
    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.ShockwaveFla sh." & 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/s...ersion=6,0,0,0" ');
    document.write(' ID="script" WIDTH="300" HEIGHT="200" ALIGN="">');
    document.write(' <PARAM NAME=movie VALUE="images/logos2.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> ');
    document.write(' <EMBED src="images/logos2.swf" quality=high bgcolor=#FFFFFF ');
    document.write(' swLiveConnect=FALSE WIDTH="463" HEIGHT="146" NAME="script" 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="images/noflash.gif" WIDTH="463" HEIGHT="146" usemap="#script" BORDER=0>');
    }
    //-->
    </SCRIPT>

    Thanks
    Melissa
    Last edited by leisuresuitlissy; March 28th, 2006 at 09:11 PM.

  2. #2
    You might be best to consider using a different detection script, rather than trying to reinvent the wheel.

    Here are a couple of alternatives:
    http://www.skyzyx.com/scripts/flash.php
    http://blog.deconcept.com/flashobject/

  3. #3
    Yeah, flashObject is great.


    K-Emmys-06: Best Footer; and K-Emmys-06: Most Active Member

  4. #4
    Yar thanks. That's what I did in the end...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012