SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jan 2006
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Flash Detection in Mozilla

    hi everyone, i am new to this forum and i have just started multi-browser testing a new site. This site has a flash swf banner that works perfectly in i.e.

    It has a flash detection scipt in java as so (as an include file):

    function isDefined(property) {
    return (typeof property != 'undefined');
    }

    var flashVersion = 0;
    function getFlashVersion() {
    var latestFlashVersion = 8;
    var agent = navigator.userAgent.toLowerCase();


    if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) {
    flashVersion = 0;
    }


    if (navigator.plugins != null && navigator.plugins.length > 0) {
    var flashPlugin = navigator.plugins['Shockwave Flash'];
    if (typeof flashPlugin == 'object') {
    for (var i = latestFlashVersion; i >= 3; i--) {
    if (flashPlugin.description.indexOf(i + '.') != -1) {
    flashVersion = i;
    break;
    }
    }
    }
    }


    else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
    var doc = '<scr' + 'ipt language="VBScript"\> \n';
    doc += 'On Error Resume Next \n';
    doc += 'Dim obFlash \n';
    doc += 'For i = ' + latestFlashVersion + ' To 3 Step -1 \n';
    doc += ' Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';
    doc += ' If IsObject(obFlash) Then \n';
    doc += ' flashVersion = i \n';
    doc += ' Exit For \n';
    doc += ' End If \n';
    doc += 'Next \n';
    doc += '</scr' + 'ipt\> \n';
    document.write(doc);
    }


    else if (agent.indexOf("webtv/2.5") != -1) flashVersion = 3;


    else if (agent.indexOf("webtv") != -1) flashVersion = 2;


    else {
    flashVersion = flashVersion_DONTKNOW;
    }

    return flashVersion;
    }

    flashVersion_DONTKNOW = -1;

    and the client side script on the page in question:

    <script type="text/javascript" src="includes/flash_detect.js">

    function getFlashVersion() { return null; };

    var requiredVersion = 6;
    var flashVersion = getFlashVersion();
    var playMovie

    if (flashVersion >= requiredVersion) {
    playMovie = 1;
    }
    else if (flashVersion <= requiredVersion) {
    playMovie = 0;
    }
    else if (flashVersion == 0) {
    playMovie = 0;
    }
    else if (flashVersion == flashVersion_DONTKNOW || flashVersion == null) {
    playMovie = 0;
    }
    </script>


    and then :

    <script type="text/javascript">
    //<![CDATA[
    if (playMovie == 1){
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="503" height="105">'
    + '<param name="movie" value="images/header.swf" />'
    + '<param name="quality" value="high" />'
    + '</object>')
    }else{
    document.write('<img src="images/header.jpg" alt="Walnut Lodge - Torquay, Devon" title="Walnut Lodge - Torquay, Devon" width="503" height="105" />')
    }//]]>
    </script>


    On one machine with mozilla 1.5 everything works!!
    on mine the detection script doesn't seem to work, which makes the banner dissapear, not even a "you need to install flash" it just leaves a blank space.

    Does anyone know what differences there could be between the two machines, as if my machine is the same of the majority of the visitors, this could cause a big problem!

    Hope someone can help

    Thanks in advance

    Ally
    Last edited by zimzimmer; Jan 27, 2006 at 11:01.

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    1. Do you have any extensions installed in Firefox that block ads or Flash?
    2. Do you have any Javascript settings that are different from the defaults?
    3. Do you have to use Javascript flash detection? This article shows an option that might be better for you, and it's more accessible than using Javascript to write out the Flash movie.

  3. #3
    SitePoint Member
    Join Date
    Jan 2006
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The installations appear to be identical. i dont have any blockers or privacy control etc.

    Java is enabled and there are various other java functions that do work on this site.

    That link is useful, but i want to use java as it's working so well in IE at the moment.

    Any other ideas? thanks for your help

    ally


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
  •