Opera <NOSCRIPT> will be executed...Flash detection

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gustav Medler

    #1

    Opera <NOSCRIPT> will be executed...Flash detection

    Hello,
    there is a known problem with Opera and the execution of content shown
    in <NOSCRIPT> tag.

    Everythings works fine, if there is only one simple script like:


    Switching off Javascript will show the alternative content. Javascript
    enabled will only show the JS-content, _not_ the <NOSCRIPT> content.

    But:
    If there are some more scripts in a page, JS content _and_ alternative
    <NOSCRIPT> content is shown, if there seems to be a script error or an
    unknown script before executing the error script. This behavior is
    according to the W3C, but IMHO not useful:
    http://www.w3.org/TR/1998/REC-html40....html#h-18.3.1

    I am developing a Flash browser detection working also with Opera, not
    only Moz/IE: There shall be displayed an alternative content, if flash
    is not supported or if flash version is to low.
    Macromedia is providing a browser detection script, which works fine
    with Opera, if _any_ flash version is installed.

    But:
    If _NO_ flash is installed (rename
    c:\Programme\Op era72\Program\P lugins\NPSWF32. dll) javascript content
    _and_ alternative <NOSCRIPT> content will be shown:


    I do not know how to solve this problem!

    There must be a problem with the following code:
    <script type="text/javascript">
    <!--
    var contentVersion = 5;
    var plugin = (navigator.mime Types &&
    navigator.mimeT ypes["applicatio n/x-shockwave-flash"]) ?
    navigator.mimeT ypes["applicatio n/x-shockwave-flash"].enabledPlugin : 0;
    if ( plugin ) {
    var words = navigator.plugi ns["Shockwave Flash"].description.sp lit(" ");
    for (var i = 0; i < words.length; ++i)
    {
    if (isNaN(parseInt (words[i])))
    continue;
    var PluginVersion = words[i];
    }
    var FlashCanPlay = PluginVersion >= contentVersion;
    }
    else if (navigator.user Agent && navigator.userA gent.indexOf("M SIE")>=0
    && (navigator.appV ersion.indexOf( "Win") != -1)) {
    [...]


    Please, are there any hints?


    X-Post2 comp.lang.javas cript,opera.pag e-authoring
    Fup2 comp.lang.javas cript

    --
    Best regards/ MfG,
    Gustav Medler
    pm.gustav.medle r (at) gmx.net
    *Mail reply will not be read,
    *please use address above!
  • Jim Ley

    #2
    Re: Opera &lt;NOSCRIPT&gt ; will be executed...Flas h detection

    On Thu, 6 Nov 2003 08:52:46 +0100, "Gustav Medler"
    <nospam.gm@nurf uerspam.de> wrote:
    [color=blue]
    >there is a known problem with Opera and the execution of content shown
    >in <NOSCRIPT> tag.[/color]

    No, as you suggest later, there's a known problem with the other UA's
    and the HTML specification.
    [color=blue]
    >I do not know how to solve this problem![/color]

    NOSCRIPT is generally useless for the above reasons, avoid it, use
    more appropriate methods to degrade (e.g. only have javascript write
    content you're unsure about, use pure HTML approaches to degrading
    flash - don't use flash...)
    [color=blue]
    >var plugin = (navigator.mime Types &&[/color]

    This needs to check for a navigator object.
    [color=blue]
    >else if (navigator.user Agent && navigator.userA gent.indexOf("M SIE")>=0[/color]

    This is flawed...

    Jim.
    --
    comp.lang.javas cript FAQ - http://jibbering.com/faq/

    Comment

    • Gustav Medler

      #3
      Re: Opera &lt;NOSCRIPT&gt ; will be executed...Flas h detection

      Jim Ley <jim@jibbering. com> wrote/schrieb:
      [color=blue][color=green]
      >> var plugin = (navigator.mime Types &&[/color]
      > This needs to check for a navigator object.[color=green]
      >> else if (navigator.user Agent &&
      >> navigator.userA gent.indexOf("M SIE")>=0[/color]
      > This is flawed...[/color]

      I do know the problems about the UA's espacially from Opera. In my
      opinion a good resolution is not to detect the UA's but using
      (!window.opera) or (window.opera). This is IMHO displayed every
      time.....

      But this issue doe not solve my problem described above.
      --
      Best regards/ MfG,
      Gustav Medler
      pm.gustav.medle r (at) gmx.net
      *Mail reply will not be read,
      *please use address above!

      Comment

      • Jim Ley

        #4
        Re: Opera &lt;NOSCRIPT&gt ; will be executed...Flas h detection

        On Thu, 6 Nov 2003 12:21:29 +0100, "Gustav Medler"
        <nospam.gm@nurf uerspam.de> wrote:
        [color=blue]
        >But this issue doe not solve my problem described above.[/color]

        Yes, I addressed that in my other points - don't use NOSCRIPT, it's
        flawed, using OBJECT or similar to just display the flash with
        appropriate degrading, or only add the flash if you've successfully
        detected that it's supported, and you can replace the fallback
        content.

        I don't really understand your actual problem - what are you putting
        in NOSCRIPT that's so disastrous that it's displayed aswell as the
        flash? if it's "install flash" then you're just misusing
        web-authoring, your page should degrade.

        Jim.
        --
        comp.lang.javas cript FAQ - http://jibbering.com/faq/

        Comment

        • Gustav Medler

          #5
          Re: Opera &lt;NOSCRIPT&gt ; will be executed...Flas h detection

          Jim Ley <jim@jibbering. com> wrote/schrieb:
          [color=blue]
          > Yes, I addressed that in my other points - don't use NOSCRIPT, it's
          > flawed, using OBJECT or similar to just display the flash with
          > appropriate degrading, or only add the flash if you've successfully
          > detected that it's supported, and you can replace the fallback
          > content.[/color]

          That's it want I want to do in Javascript ;-)
          But Opera seems to be a little bit particular especially if _no_ flash
          plugin is installed. All tested cases are working under all
          circumstances, NS4.7, Moz, Konqueror, IE. Only Opera shows the problem
          of displaying script _and_ noscript content simultaneously.
          [color=blue]
          > I don't really understand your actual problem - what are you putting
          > in NOSCRIPT that's so disastrous that it's displayed aswell as the
          > flash? if it's "install flash" then you're just misusing
          > web-authoring, your page should degrade.[/color]

          On the one hand the NOSCRIPT content shall be a static picture of the
          animated content. I will not ask a visitor to install or update the
          flash plugin, because in my opinion it will be boring for them.
          On the second hand there are some layout problems if _no_ content is
          displayed.

          How to change this script for detecting that no plugin is installed in
          an Opera browser?
          [Example page at: http://www.dr-wald.de/test/mainframetest.html ]


          <script type="text/javascript">
          <!--
          var contentVersion = 5;
          var plugin = (navigator.mime Types &&
          navigator.mimeT ypes["applicatio n/x-shockwave-flash"]) ?
          navigator.mimeT ypes["applicatio n/x-shockwave-flash"].enabledPlugin : 0;
          if ( plugin ) {
          var words = navigator.plugi ns["Shockwave Flash"].description.sp lit(" ");
          for (var i = 0; i < words.length; ++i)
          {
          if (isNaN(parseInt (words[i])))
          continue;
          var PluginVersion = words[i];
          }
          var FlashCanPlay = PluginVersion >= contentVersion;
          }
          else if (navigator.user Agent && navigator.userA gent.indexOf("M SIE")>=0
          && (navigator.appV ersion.indexOf( "Win") != -1)) {
          [...]
          --
          Best regards/ MfG,
          Gustav Medler
          pm.gustav.medle r (at) gmx.net
          *Mail reply will not be read,
          *please use address above!

          Comment

          • Jim Ley

            #6
            Re: Opera &lt;NOSCRIPT&gt ; will be executed...Flas h detection

            On Thu, 6 Nov 2003 16:17:25 +0100, "Gustav Medler"
            <nospam.gm@nurf uerspam.de> wrote:
            [color=blue]
            >On the one hand the NOSCRIPT content shall be a static picture of the
            >animated content. I will not ask a visitor to install or update the
            >flash plugin, because in my opinion it will be boring for them.[/color]

            Great, so use your script, detect flash, if it's found replace the
            fallback image in the page with the flash, no need to do anything in
            the situation where flash isn't detected, you just leave the document
            as is, same as when script is disabled.
            [color=blue]
            >else if (navigator.user Agent && navigator.userA gent.indexOf("M SIE")>=0
            >&& (navigator.appV ersion.indexOf( "Win") != -1)) {[/color]

            As I noted before, this script is flawed, your problem is a lot more
            than opera with this approach.

            Jim.
            --
            comp.lang.javas cript FAQ - http://jibbering.com/faq/

            Comment

            • Gustav Medler

              #7
              Re: Opera &lt;NOSCRIPT&gt ; will be executed...Flas h detection

              Jim Ley <jim@jibbering. com> wrote/schrieb:
              [color=blue]
              > Great, so use your script, detect flash, if it's found replace the
              > fallback image in the page with the flash, no need to do anything in
              > the situation where flash isn't detected, you just leave the document
              > as is, same as when script is disabled.[/color]

              Resolution found!

              Problem:
              JS-Browser detection works fine if any version of flash plugin
              (vers.2-7) is installed. If there is _NO_ flash plugin installed, SCRIPT
              and NOSCRIPT content will be executed by Opera, pictures for example
              will be shown twice.
              This behavior is according to W3C because Opera does not know the
              'SCRIPT LANGUAGE=VBScri pt' and will trade it as a script error with
              execution of the NOSCRIPT content.
              http://www.w3.org/TR/1998/REC-html40....html#h-18.3.1

              Resolution:
              This behaviour can be solved simply by adding 'window.opera &&' to this
              line of the detection script:

              else if (navigator.user Agent && navigator.userA gent.indexOf("M SIE")>=0
              && (navigator.appV ersion.indexOf( "Win") != -1)) {

              Better version:

              else if (!window.opera && navigator.userA gent &&
              navigator.userA gent.indexOf("M SIE")>=0 &&
              (navigator.appV ersion.indexOf( "Win") != -1)) {

              Browser detection in Opera is difficult because of spoofing, but IMHO
              'Opera' will always be shown.....

              The whole flash detection script works now including display of alternative
              content
              for 'too low flash version',
              for 'no flash plugin detected/installed' and
              for 'javascript disabled'
              in NS4.7+, IE 5+, Opera5+, Moz1+, Konqueror3+ on Win32/Linux.

              [Somebody surfing with MAC???]

              Whole detection script:

              <!-- Start Flash -->
              <script type="text/javascript">
              <!--
              var contentVersion = 5;
              var plugin = (navigator.mime Types &&
              navigator.mimeT ypes["applicatio n/x-shockwave-flash"]) ?
              navigator.mimeT ypes["applicatio n/x-shockwave-flash"].enabledPlugin : 0;
              if ( plugin ) {
              var words = navigator.plugi ns["Shockwave Flash"].description.sp lit(" ");
              for (var i = 0; i < words.length; ++i)
              {
              if (isNaN(parseInt (words[i])))
              continue;
              var PluginVersion = words[i];
              }
              var FlashCanPlay = PluginVersion >= contentVersion;
              }
              else if (!window.opera && navigator.userA gent &&
              navigator.userA gent.indexOf("M SIE")>=0 &&
              (navigator.appV ersion.indexOf( "Win") != -1)) {
              document.write( '<SCR' + 'IPT LANGUAGE=VBScri pt\> \n');
              document.write( 'on error resume next \n');
              document.write( 'FlashCanPlay = (
              IsObject(Create Object("Shockwa veFlash.Shockwa veFlash." &
              contentVersion) ))\n');
              document.write( '</SCR' + 'IPT\> \n');
              }
              if ( FlashCanPlay ) {
              document.write( '<OBJECT
              classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000"
              codebase="http://download.macrom edia.com/pub/shockwave/cabs/flash/swflas
              h.cab#version=6 ,0,0,0" ID="schloss_gr " WIDTH="365" HEIGHT="265">') ;
              document.write( '<PARAM NAME="movie" VALUE="schloss_ gr.swf"><PARAM
              NAME="quality" VALUE="high"><P ARAM NAME="scale" VALUE="exactfit "><PARAM
              NAME="bgcolor" VALUE="#E2E2E2" >');
              document.write( '<EMBED src="schloss_gr .swf" quality="high"
              scale="exactfit " bgcolor="#E2E2E 2" swLiveConnect=F ALSE WIDTH="365"
              HEIGHT="265" NAME="schloss_g r" TYPE="applicati on/x-shockwave-flash"
              PLUGINSPAGE="ht tp://www.macromedia. com/go/getflashplayer" >');
              document.write( '</EMBED>');
              document.write( '</OBJECT>');
              } else{
              document.write( '<a href="../start/index.html" target="_parent "><img
              src="../index/schloss_gr.jpg" width="365" height="245" border="0"
              alt="Praxis"></a>');}
              //--></script>

              <noscript>
              <a href="../start/index.html" target="_parent "><img
              src="../index/schloss_gr.jpg" width="365" height="245" border="0"
              alt="Praxis"></a>
              </noscript>
              <!-- End Flash -->
              --
              Best regards/ MfG,
              Gustav Medler
              pm.gustav.medle r (at) gmx.net
              *Mail reply will not be read,
              *please use address above!

              Comment

              Working...