JavaScript detection advanced



  • This is a function created by Camtasia 6

       function divClickHandler()
       {
          var req = swfobject.hasFlashPlayerVersion("9.0.115");
       var id = "video1";
       var bookmark = args.movie ? args.movie : 0;
       var node = '<div id="cs_noexpressUpdate">'
                + '<p align="center">The Camtasia Studio video content presented here </p><p align="center"> requires JavaScript to be enabled and the latest version </p><p align="center">of the Adobe Flash Player.  If you are you using </p><p align="center">a browser with JavaScript disabled please enable it now.</p><p align="center"> Otherwise, please update your version of the </p><p align="center">free Flash Player by <a href="http://www.adobe.com/go/getflashplayer">downloading here</a>. </p>'
                + '</div>';

       if ( req )
       {
          swfobject.embedSWF( "Einführung VS Teil 2_controller.swf", id, "1024", "787", "9.0.115", null, { csConfigFile: "Einführung VS Teil 2_config.xml", csColor: "FFFFFF", csPreloader: "Einführung VS Teil 2_preload.swf", csFilesetBookmark: bookmark }, { bgcolor: "FFFFFF", quality: "best", allowscriptaccess: "always" } );
       }
       else
       {
          var n = (typeof id == 'string') ? document.getElementById( id ) : id;
          n.innerHTML = node;
       };
         
          removeEvent( vid, 'click', divClickHandler );
       }
     



  •  And the WTF is?

    Ok, it could probably have been done more efficient, but it does what it does do and it's clear what it does, what more do you want?


  • Discourse touched me in a no-no place

    @dtech said:

     And the WTF is?
    They have a "you need javascript enabled <font color="#808080">[and latest version of <blah>]</font>" message that is displayed only if you have javascript enabled?

    I'm presuming there is no message whatsoever if javascript is not enabled.



  • @PJH said:

    @dtech said:

     And the WTF is?
    They have a "you need javascript enabled <font color="#808080">[and latest version of <blah>]</font>" message that is displayed only if you have javascript enabled?

    I'm presuming there is no message whatsoever if javascript is not enabled.

    Also (guessing from the function name) they probably have a div with a still shot of the video and it loads the flash player when you click on it.  And only then will you know that you didn't have an up-to-date flash player.


  • @dtech said:

     And the WTF is?

    Ok, it could probably have been done more efficient, but it does what it does do and it's clear what it does, what more do you want?

     

    The WTF is they improperly used HTML elements. They used </p><p> in the middle of the sentence instead of <br />


Log in to reply