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 11 of 11
  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Simple flash detection to write to form

    Hi, I'm trying to make this script to write values to a form. The browser, platform and screen res works fine, but the flash detection returns as No even though flash plugin is present.

    <SCRIPT LANGUAGE="JavaScript">

    function display() {
    window.onerror=null;

    document.form.browser.value = navigator.appName;
    document.form.platform.value = navigator.platform;
    document.form.width.value = window.screen.width;
    document.form.height.value = window.screen.height;

    if (window.flashinstalled) document.form.flash.value="Yes";
    else document.form.flash.value="No";
    }
    </script>

    I'm all new to javascripting (as you can see), so I'd really appreciate a simple answer (if there is one)
    Tried to find a solution in the forum, but couldn't find what I need...

    Cheers!
    Lars

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Glenn, but I still don't get it to work. The script is too complex for me to understand, but I tried to follow the instructions. I saved the flash.js and added these scripts to my head;

    <script language="JavaScript" type="text/javascript" src="flash.js"></script>
    <script language="JavaScript" type="text/javascript">
    <!--

    if (flash.ver[6])
    {
    document.form.flash.value="Yes";

    }
    else if (flash.installed)
    {
    document.form.flash.value="Yes";

    }
    else
    {
    document.form.flash.value="No";

    }

    //-->
    </script>

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    I think you're accessing the flash field before it is even loaded to the page. You should set the field once the page has loaded. You should do it on onload. And you're only interested if the browser has flash or not, not in the version, so you don't need to check flash.ver[n] values, only the flash.installed property.

    window.onload = function(){
    document.form.flash.value = (flash.installed) ? "Yes":"No";
    }
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #5
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks again Glenn, but it still returns as No, both on mac (safari, explorer and mozilla), and win (explorer). Any other suggestions?

    Lars

  • #6
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Can you view Skyzyx site again using those browsers and see if his code works.
    There is a sample output in that page that checks the plugin of the browsers used.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #7
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    All the browsers get a result on skyzyx, so I guess it's my implementation that fails...

  • #8
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    So could you post your codes then?
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #9
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is where I'm at with the skyzyx code. I have tried it in different combinations of head and body, and also with and without the flash.js, but it either returns nothing or No. My apologies if I'm being slow...


    <script language="JavaScript" type="text/javascript" src="../flash.js"></script>
    <script language="JavaScript" type="text/javascript">
    <!--

    window.onload
    if (flash.installed)
    {
    document.form.flash.value="Yes";
    }

    else
    {
    document.form.flash.value="No";
    }

    //-->
    </script>

  • #10
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Code:
    <html>
    <head>
    <script language="JavaScript" type="text/javascript" src="../flash.js"></script>
    <script language="JavaScript" type="text/javascript">
    <!--
    
    window.onload = function() {
       if (flash.installed)
       {
          document.form.flash.value="Yes";
       }
       else
       {
          document.form.flash.value="No";
       }
    }
    //-->
    </script>
    </head>
    <body>
    <form name="form">
    <input type="text" name="flash" />
    </form>
    </body>
    </html>
    Make sure that the path of the flash.js file is correct.
    Check for possible js errors in Javascript console (NS/Moz) or error notification in IE (double-click "!" icon in the status bar, if any)
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #11
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you, it needed a little tweak to get it to work together with other scripts, but now it works like a charm!
    Thanks again!
    Lars


  •  

    Posting Permissions

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