Loading ...
Sorry, an error occurred while loading the content.

Detect native SVG support

Expand Messages
  • jophof007
    Hi, Does anyone has a solution on detecting native svg support. Deer park Alpha 2 supports native svg. How can a client javascript detect that deerpark alpha 2
    Message 1 of 23 , Jul 23, 2005
    • 0 Attachment
      Hi,

      Does anyone has a solution on detecting native svg support. Deer park
      Alpha 2 supports native svg. How can a client javascript detect that
      deerpark alpha 2 is running or how can a client javascript detect that
      native svg support is available?

      We like to make our diagram editor native svg compliant in
      open-modeing (http://open-modeing.sourceforge.net).

      Thanx in advance.

      John
    • Holger Will
      ... Hi John there are several ways to do so, first of all you can use to show alternative content, so
      Message 2 of 23 , Jul 24, 2005
      • 0 Attachment
        jophof007 schrieb:

        > Hi,
        >
        > Does anyone has a solution on detecting native svg support. Deer park
        > Alpha 2 supports native svg. How can a client javascript detect that
        > deerpark alpha 2 is running or how can a client javascript detect that
        > native svg support is available?
        >
        > We like to make our diagram editor native svg compliant in
        > open-modeing (http://open-modeing.sourceforge.net).
        > <http://open-modeing.sourceforge.net%29.>
        >
        > Thanx in advance.
        >
        > John

        Hi John

        there are several ways to do so,

        first of all you can use <object> to show alternative content,
        so

        <object type="image/svg+xml" data="rect.svg"> Your browser cannot display SVG </object>

        now you can use java script to get object.contentDocument , this interface only exists in firefox ( opera ? ), and only if svg is enabled.

        if you do something similar to the above, but use embedd, the script will work for native SVG in mozilla and IE+ASV3/6


        <embed id="em" src="test.svg" type="image/svg+xml" width="500" height="500"/>

        function testSVG(){

        var svg=document.getElementById("em")
        if(svg.getSVGDocument()){
        alert("your browser supports SVG")
        }
        }

        or you might check for the support of inlined SVG, this works in mozilla and opera.

        <?xml version="1.0"?>
        <html xmlns="http://www.w3.org/1999/xhtml" >
        <head>
        </head>
        <script>
        function testSVG1(){

        var svg=document.getElementById("testSVG")
        if(svg.namespaceURI=="http://www.w3.org/2000/svg"){
        alert("your broser supports inlined SVG")
        }
        }
        </script>
        <body onload="testSVG1()">
        <svg id="testSVG" xmlns="http://www.w3.org/2000/svg"/>
        </body>

        </html>

        these are just some ideas,
        hope that helps
        Holger



        <cid:part1.08050001.04030209@...>
      • Martin Honnen
        ... mozilla and opera. ... I don t think that test above will tell you whether the browser supports inline SVG, all you do is checking the namespaceURI
        Message 3 of 23 , Jul 24, 2005
        • 0 Attachment
          --- In svg-developers@yahoogroups.com, Holger Will <holger@t...> wrote:
          > jophof007 schrieb:
          >
          > >
          > > Does anyone has a solution on detecting native svg support. Deer park
          > > Alpha 2 supports native svg. How can a client javascript detect that
          > > deerpark alpha 2 is running or how can a client javascript detect that
          > > native svg support is available?
          > >

          >
          > or you might check for the support of inlined SVG, this works in
          mozilla and opera.
          >
          > <?xml version="1.0"?>
          > <html xmlns="http://www.w3.org/1999/xhtml" >
          > <head>
          > </head>
          > <script>
          > function testSVG1(){
          >
          > var svg=document.getElementById("testSVG")
          > if(svg.namespaceURI=="http://www.w3.org/2000/svg"){
          > alert("your broser supports inlined SVG")
          > }
          > }
          > </script>
          > <body onload="testSVG1()">
          > <svg id="testSVG" xmlns="http://www.w3.org/2000/svg"/>

          I don't think that test above will tell you whether the browser
          supports inline SVG, all you do is checking the namespaceURI property
          of an element node in an XML document using elements in different
          namespaces, any W3C DOM Level 2 implementation should do that whether
          it knows about SVG or not. And you kind of check whether the browser
          implements getElementById on that <svg id="testSVG"> element but if
          that is the intension then you should check the result of the
          getElementById call before trying to access it as otherwise you can
          create a script error.
          For instance Opera 7.50 when served the above as application/xhtml+xml
          will show the alert while it certainly does not know to render SVG.
          Mozilla 1.7 does not show the alert but not because the test with the
          namespace is any good to detect SVG support but because the
          getElementById does not return an object but null and then the next
          line gives a script error.
        • Holger Will
          ... Hi Martin mmh yes it seems your are completely right, it was just an idea, i admit a bad one. maybe the best way is to test for interdocument communication
          Message 4 of 23 , Jul 24, 2005
          • 0 Attachment
            Martin Honnen schrieb:

            > --- In svg-developers@yahoogroups.com, Holger Will <holger@t...> wrote:
            > > jophof007 schrieb:
            > >
            > > >
            > > > Does anyone has a solution on detecting native svg support. Deer park
            > > > Alpha 2 supports native svg. How can a client javascript detect that
            > > > deerpark alpha 2 is running or how can a client javascript detect that
            > > > native svg support is available?
            > > >
            >
            > >
            > > or you might check for the support of inlined SVG, this works in
            > mozilla and opera.
            > >
            > > <?xml version="1.0"?>
            > > <html xmlns="http://www.w3.org/1999/xhtml" >
            > > <head>
            > > </head>
            > > <script>
            > > function testSVG1(){
            > >
            > > var svg=document.getElementById("testSVG")
            > > if(svg.namespaceURI=="http://www.w3.org/2000/svg"){
            > > alert("your broser supports inlined SVG")
            > > }
            > > }
            > > </script>
            > > <body onload="testSVG1()">
            > > <svg id="testSVG" xmlns="http://www.w3.org/2000/svg"/>
            >
            > I don't think that test above will tell you whether the browser
            > supports inline SVG, all you do is checking the namespaceURI property
            > of an element node in an XML document using elements in different
            > namespaces, any W3C DOM Level 2 implementation should do that whether
            > it knows about SVG or not. And you kind of check whether the browser
            > implements getElementById on that <svg id="testSVG"> element but if
            > that is the intension then you should check the result of the
            > getElementById call before trying to access it as otherwise you can
            > create a script error.
            > For instance Opera 7.50 when served the above as application/xhtml+xml
            > will show the alert while it certainly does not know to render SVG.
            > Mozilla 1.7 does not show the alert but not because the test with the
            > namespace is any good to detect SVG support but because the
            > getElementById does not return an object but null and then the next
            > line gives a script error.
            >
            >
            Hi Martin

            mmh yes it seems your are completely right, it was just an idea, i admit
            a bad one.
            maybe the best way is to test for interdocument communication abilitys
            (SVGDocument / window)
            like:
            http://jwatt.org/svg/demos/scripting-across-object.html
            http://jwatt.org/svg/demos/scripting-across-embed.html

            cheers
            Holger
          • Jonathan Watt
            Perhaps something like var hasNativeSVG = document.createElementNS( http://www.w3.org/2000/svg , svg ).viewBox ? true : false; will do what you want? If the
            Message 5 of 23 , Jul 27, 2005
            • 0 Attachment
              Perhaps something like

              var hasNativeSVG =
              document.createElementNS('http://www.w3.org/2000/svg','svg').viewBox ?
              true : false;

              will do what you want? If the implementation doesn't support SVG, then
              the element it creates won't have a 'viewBox' property. There's
              probably a lighterweight way of doing this, but I haven't thought
              about it too deeply. ;-)


              On 7/23/05, jophof007 <jophof007@...> wrote:
              > Hi,
              >
              > Does anyone has a solution on detecting native svg support. Deer park
              > Alpha 2 supports native svg. How can a client javascript detect that
              > deerpark alpha 2 is running or how can a client javascript detect that
              > native svg support is available?
              >
              > We like to make our diagram editor native svg compliant in
              > open-modeing (http://open-modeing.sourceforge.net).
              >
              > Thanx in advance.
              >
              > John
              >
              >
              >
              >
              > -----
              > To unsubscribe send a message to: svg-developers-unsubscribe@yahoogroups.com
              > -or-
              > visit http://groups.yahoo.com/group/svg-developers and click "edit my membership"
              > ----
              > Yahoo! Groups Links
              >
              >
              >
              >
              >
              >
              >
            • jophof007
              Hi, Sounds as a solution. But Mozilla is trying to implement zoom and pan things so a viewbox will appear in future I think. It is not that easy to determine.
              Message 6 of 23 , Jul 27, 2005
              • 0 Attachment
                Hi,

                Sounds as a solution. But Mozilla is trying to implement zoom and pan
                things so a viewbox will appear in future I think.
                It is not that easy to determine.

                John
                --- In svg-developers@yahoogroups.com, Jonathan Watt <wattie@g...> wrote:
                > Perhaps something like
                >
                > var hasNativeSVG =
                > document.createElementNS('http://www.w3.org/2000/svg','svg').viewBox ?
                > true : false;
                >
                > will do what you want? If the implementation doesn't support SVG, then
                > the element it creates won't have a 'viewBox' property. There's
                > probably a lighterweight way of doing this, but I haven't thought
                > about it too deeply. ;-)
                >
                >
                > On 7/23/05, jophof007 <jophof007@h...> wrote:
                > > Hi,
                > >
                > > Does anyone has a solution on detecting native svg support. Deer park
                > > Alpha 2 supports native svg. How can a client javascript detect that
                > > deerpark alpha 2 is running or how can a client javascript detect that
                > > native svg support is available?
                > >
                > > We like to make our diagram editor native svg compliant in
                > > open-modeing (http://open-modeing.sourceforge.net).
                > >
                > > Thanx in advance.
                > >
                > > John
                > >
                > >
                > >
                > >
                > > -----
                > > To unsubscribe send a message to:
                svg-developers-unsubscribe@yahoogroups.com
                > > -or-
                > > visit http://groups.yahoo.com/group/svg-developers and click "edit
                my membership"
                > > ----
                > > Yahoo! Groups Links
                > >
                > >
                > >
                > >
                > >
                > >
                > >
              • Jonathan Watt
                Hi John, Mozilla has supported the viewBox property for a long time, but let s forget about that. It would actually be better to use a property that will
                Message 7 of 23 , Jul 27, 2005
                • 0 Attachment
                  Hi John,

                  Mozilla has supported the 'viewBox' property for a long time, but
                  let's forget about that. It would actually be better to use a property
                  that will almost certainly be implemented - the 'width' property seems
                  like a good candidate. So you would use:

                  var hasNativeSVG =
                  document.createElementNS('http://www.w3.org/2000/svg','svg').width ?
                  true : false;

                  I'm not sure I can explain why this should work any clearer than I
                  already have, but here goes. If the implementation doesn't support
                  SVG, then the element that's created as a result of the
                  createElementNS call *won't* have a 'width' property. If the
                  implementation does support SVG, then the element that's created as a
                  result of the createElementNS call *will* have a 'width' property.
                  This seems like a good way to test for native SVG support to me. If
                  you don't think so, can you have a go at explain why?

                  Regards,
                  Jonathan


                  On 7/27/05, jophof007 <jophof007@...> wrote:
                  > Hi,
                  >
                  > Sounds as a solution. But Mozilla is trying to implement zoom and pan
                  > things so a viewbox will appear in future I think.
                  > It is not that easy to determine.
                  >
                  > John
                  > --- In svg-developers@yahoogroups.com, Jonathan Watt <wattie@g...> wrote:
                  > > Perhaps something like
                  > >
                  > > var hasNativeSVG =
                  > > document.createElementNS('http://www.w3.org/2000/svg','svg').viewBox ?
                  > > true : false;
                  > >
                  > > will do what you want? If the implementation doesn't support SVG, then
                  > > the element it creates won't have a 'viewBox' property. There's
                  > > probably a lighterweight way of doing this, but I haven't thought
                  > > about it too deeply. ;-)
                  > >
                  > >
                  > > On 7/23/05, jophof007 <jophof007@h...> wrote:
                  > > > Hi,
                  > > >
                  > > > Does anyone has a solution on detecting native svg support. Deer park
                  > > > Alpha 2 supports native svg. How can a client javascript detect that
                  > > > deerpark alpha 2 is running or how can a client javascript detect that
                  > > > native svg support is available?
                  > > >
                  > > > We like to make our diagram editor native svg compliant in
                  > > > open-modeing (http://open-modeing.sourceforge.net).
                  > > >
                  > > > Thanx in advance.
                  > > >
                  > > > John
                  > > >
                  > > >
                  > > >
                  > > >
                  > > > -----
                  > > > To unsubscribe send a message to:
                  > svg-developers-unsubscribe@yahoogroups.com
                  > > > -or-
                  > > > visit http://groups.yahoo.com/group/svg-developers and click "edit
                  > my membership"
                  > > > ----
                  > > > Yahoo! Groups Links
                  > > >
                  > > >
                  > > >
                  > > >
                  > > >
                  > > >
                  > > >
                  >
                  >
                  >
                  >
                  >
                  > -----
                  > To unsubscribe send a message to: svg-developers-unsubscribe@yahoogroups.com
                  > -or-
                  > visit http://groups.yahoo.com/group/svg-developers and click "edit my membership"
                  > ----
                  > Yahoo! Groups Links
                  >
                  >
                  >
                  >
                  >
                  >
                  >
                • Holger Will
                  ... Hi Jonathan, in most cases i tend to favor the alternate content - syntax, which works without script. i ve tried the following without
                  Message 8 of 23 , Jul 28, 2005
                  • 0 Attachment
                    Jonathan Watt schrieb:

                    > Hi John,
                    >
                    > Mozilla has supported the 'viewBox' property for a long time, but
                    > let's forget about that. It would actually be better to use a property
                    > that will almost certainly be implemented - the 'width' property seems
                    > like a good candidate. So you would use:
                    >
                    > var hasNativeSVG =
                    > document.createElementNS('http://www.w3.org/2000/svg','svg').width
                    > <http://www.w3.org/2000/svg%27,%27svg%27%29.width> ?
                    > true : false;
                    >
                    > I'm not sure I can explain why this should work any clearer than I
                    > already have, but here goes. If the implementation doesn't support
                    > SVG, then the element that's created as a result of the
                    > createElementNS call *won't* have a 'width' property. If the
                    > implementation does support SVG, then the element that's created as a
                    > result of the createElementNS call *will* have a 'width' property.
                    > This seems like a good way to test for native SVG support to me. If
                    > you don't think so, can you have a go at explain why?
                    >
                    > Regards,
                    > Jonathan
                    >
                    Hi Jonathan,

                    in most cases i tend to favor the "<object>alternate content</object>" -
                    syntax, which works without script.
                    i've tried the following without success, and i wonder if the behavior
                    is specified like this or if its a bug.

                    <object ... >
                    <img ... onload="alert('SVG not supported')/>
                    </object>

                    THIS DOES NOT WORK !
                    the onload allways gets fired. is this right? do html clients allways
                    load both the objects content and the alternate content ?
                    is there another event that can be used ? is there any other specified
                    way to determin if object renders the original content or the alternate
                    content ?

                    cheers
                    Holger
                  • Jonathan Watt
                    First off, I ve noticed that my suggested script doesn t work in IE6 since it doesn t seem to implement createElementNS. To prevent a script error I ll revise
                    Message 9 of 23 , Jul 28, 2005
                    • 0 Attachment
                      First off, I've noticed that my suggested script doesn't work in IE6
                      since it doesn't seem to implement createElementNS. To prevent a
                      script error I'll revise my script to:

                      var hasNativeSVG = false;
                      try {
                      if (document.createElementNS('http://www.w3.org/2000/svg','svg').width)
                      hasNativeSVG = true;
                      } catch (e) { /* ignore exception */ };


                      On 7/28/05, Holger Will <holger@...> wrote:
                      > Hi Jonathan,
                      >
                      > in most cases i tend to favor the "<object>alternate content</object>" -
                      > syntax, which works without script.

                      Yup, but John asked for a script, so that's what I was trying to do.
                      Also the <object> approach will not differentiate between plug-in and
                      native support.

                      > i've tried the following without success, and i wonder if the behavior
                      > is specified like this or if its a bug.
                      > <object ... >
                      > <img ... onload="alert('SVG not supported')/>
                      > </object>

                      I thought you were trying not to rely on script support. j/k ;-)

                      > THIS DOES NOT WORK !
                      > the onload allways gets fired. is this right? do html clients allways
                      > load both the objects content and the alternate content ?
                      > is there another event that can be used ? is there any other specified
                      > way to determin if object renders the original content or the alternate
                      > content ?

                      Hmm, I'm not sure. That the onload get's evaluated seems like a bug to me.

                      -Jonathan
                    • Holger Will
                      ... i should have statet that this is a bit off topic. your script seems like a very clean and easy solution ! ... i still do :-) i was just wondering ... ...
                      Message 10 of 23 , Jul 28, 2005
                      • 0 Attachment
                        Jonathan Watt schrieb:

                        > First off, I've noticed that my suggested script doesn't work in IE6
                        > since it doesn't seem to implement createElementNS. To prevent a
                        > script error I'll revise my script to:
                        >
                        > var hasNativeSVG = false;
                        > try {
                        > if
                        > (document.createElementNS('http://www.w3.org/2000/svg','svg').width)
                        > <http://www.w3.org/2000/svg%27,%27svg%27%29.width%29>
                        > hasNativeSVG = true;
                        > } catch (e) { /* ignore exception */ };
                        >
                        >
                        > On 7/28/05, Holger Will <holger@...> wrote:
                        > > Hi Jonathan,
                        > >
                        > > in most cases i tend to favor the "<object>alternate content</object>" -
                        > > syntax, which works without script.
                        >
                        > Yup, but John asked for a script, so that's what I was trying to do.
                        > Also the <object> approach will not differentiate between plug-in and
                        > native support.

                        i should have statet that this is a bit off topic. your script seems
                        like a very clean and easy solution !

                        >
                        > > i've tried the following without success, and i wonder if the behavior
                        > > is specified like this or if its a bug.
                        > > <object ... >
                        > > <img ... onload="alert('SVG not supported')/>
                        > > </object>
                        >
                        > I thought you were trying not to rely on script support. j/k ;-)

                        i still do :-) i was just wondering ...

                        >
                        > > THIS DOES NOT WORK !
                        > > the onload allways gets fired. is this right? do html clients allways
                        > > load both the objects content and the alternate content ?
                        > > is there another event that can be used ? is there any other specified
                        > > way to determin if object renders the original content or the alternate
                        > > content ?
                        >
                        > Hmm, I'm not sure. That the onload get's evaluated seems like a bug to me.

                        yeah it seems strange but at least mozilla, opera and ie agree on the
                        behaviour :-)
                        so even if mozilla would get this right, it would be as useless as
                        contentDocument
                        for cross browser detection of svg support.

                        thanks for your comments anyways
                        Holger

                        >
                        > -Jonathan
                        >
                        >
                        > -----
                        > To unsubscribe send a message to:
                        > svg-developers-unsubscribe@yahoogroups.com
                        > -or-
                        > visit http://groups.yahoo.com/group/svg-developers and click "edit my
                        > membership"
                        > ----
                        >
                        >
                        > ------------------------------------------------------------------------
                        > YAHOO! GROUPS LINKS
                        >
                        > * Visit your group "svg-developers
                        > <http://groups.yahoo.com/group/svg-developers>" on the web.
                        >
                        > * To unsubscribe from this group, send an email to:
                        > svg-developers-unsubscribe@yahoogroups.com
                        > <mailto:svg-developers-unsubscribe@yahoogroups.com?subject=Unsubscribe>
                        >
                        > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
                        > Service <http://docs.yahoo.com/info/terms/>.
                        >
                        >
                        > ------------------------------------------------------------------------
                        >
                      • Holger Will
                        ... i dont know what ive tested last time, but this indeed seems to work in IE and Opera, so this is probably a bug in mozilla, in which component would i
                        Message 11 of 23 , Jul 28, 2005
                        • 0 Attachment
                          Holger Will schrieb:

                          > Jonathan Watt schrieb:
                          >
                          > > First off, I've noticed that my suggested script doesn't work in IE6
                          > > since it doesn't seem to implement createElementNS. To prevent a
                          > > script error I'll revise my script to:
                          > >
                          > > var hasNativeSVG = false;
                          > > try {
                          > > if
                          > > (document.createElementNS('http://www.w3.org/2000/svg','svg').width)
                          > <http://www.w3.org/2000/svg%27,%27svg%27%29.width%29>
                          > > <http://www.w3.org/2000/svg%27,%27svg%27%29.width%29>
                          > > hasNativeSVG = true;
                          > > } catch (e) { /* ignore exception */ };
                          > >
                          > >
                          > > On 7/28/05, Holger Will <holger@...> wrote:
                          > > > Hi Jonathan,
                          > > >
                          > > > in most cases i tend to favor the "<object>alternate
                          > content</object>" -
                          > > > syntax, which works without script.
                          > >
                          > > Yup, but John asked for a script, so that's what I was trying to do.
                          > > Also the <object> approach will not differentiate between plug-in and
                          > > native support.
                          >
                          > i should have statet that this is a bit off topic. your script seems
                          > like a very clean and easy solution !
                          >
                          > >
                          > > > i've tried the following without success, and i wonder if the behavior
                          > > > is specified like this or if its a bug.
                          > > > <object ... >
                          > > > <img ... onload="alert('SVG not supported')/>
                          > > > </object>
                          > >
                          > > I thought you were trying not to rely on script support. j/k ;-)
                          >
                          > i still do :-) i was just wondering ...
                          >
                          > >
                          > > > THIS DOES NOT WORK !
                          > > > the onload allways gets fired. is this right? do html clients allways
                          > > > load both the objects content and the alternate content ?
                          > > > is there another event that can be used ? is there any other specified
                          > > > way to determin if object renders the original content or the
                          > alternate
                          > > > content ?
                          > >
                          > > Hmm, I'm not sure. That the onload get's evaluated seems like a bug
                          > to me.
                          >
                          > yeah it seems strange but at least mozilla, opera and ie agree on the
                          > behaviour :-)
                          > so even if mozilla would get this right, it would be as useless as
                          > contentDocument
                          > for cross browser detection of svg support.
                          >
                          > thanks for your comments anyways
                          > Holger
                          >
                          i dont know what ive tested last time, but this indeed seems to work in
                          IE and Opera, so this is probably a bug in mozilla,
                          in which component would i post this bug ?

                          Holger
                        • Mark Birbeck
                          Dear all, We shouldn t really have to check for the existence of methods, etc. An HTML DOM that can have SVG inline should really return true for one of:
                          Message 12 of 23 , Jul 28, 2005
                          • 0 Attachment
                            Dear all,

                            We shouldn't really have to check for the existence of methods, etc. An HTML
                            DOM that can have SVG inline should really return true for one of:

                            document.implementation.hasFeature("org.w3c.dom.svg", "1.0")

                            or:


                            document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#SVG",
                            "1.1")

                            I haven't tried it, but I would say that's what Opera and Mozilla _should_
                            provide (and may well do).

                            Regards,

                            Mark



                            Mark Birbeck
                            CEO
                            x-port.net Ltd.

                            e: Mark.Birbeck@...
                            t: +44 (0) 20 7689 9232
                            w: http://www.formsPlayer.com/
                            b: http://internet-apps.blogspot.com/

                            Download our XForms processor from
                            http://www.formsPlayer.com/

                            > -----Original Message-----
                            > From: svg-developers@yahoogroups.com
                            > [mailto:svg-developers@yahoogroups.com] On Behalf Of Holger Will
                            > Sent: 28 July 2005 19:38
                            > To: svg-developers@yahoogroups.com
                            > Subject: Re: [svg-developers] Re: Detect native SVG support
                            >
                            > Holger Will schrieb:
                            >
                            > > Jonathan Watt schrieb:
                            > >
                            > > > First off, I've noticed that my suggested script doesn't
                            > work in IE6
                            > > > since it doesn't seem to implement createElementNS. To prevent a
                            > > > script error I'll revise my script to:
                            > > >
                            > > > var hasNativeSVG = false;
                            > > > try {
                            > > > if
                            > > >
                            > (document.createElementNS('http://www.w3.org/2000/svg','svg').width)
                            > > <http://www.w3.org/2000/svg%27,%27svg%27%29.width%29>
                            > > > <http://www.w3.org/2000/svg%27,%27svg%27%29.width%29>
                            > > > hasNativeSVG = true;
                            > > > } catch (e) { /* ignore exception */ };
                            > > >
                            > > >
                            > > > On 7/28/05, Holger Will <holger@...> wrote:
                            > > > > Hi Jonathan,
                            > > > >
                            > > > > in most cases i tend to favor the "<object>alternate
                            > > content</object>" -
                            > > > > syntax, which works without script.
                            > > >
                            > > > Yup, but John asked for a script, so that's what I was
                            > trying to do.
                            > > > Also the <object> approach will not differentiate between plug-in
                            > > > and native support.
                            > >
                            > > i should have statet that this is a bit off topic. your
                            > script seems
                            > > like a very clean and easy solution !
                            > >
                            > > >
                            > > > > i've tried the following without success, and i wonder if the
                            > > > > behavior is specified like this or if its a bug.
                            > > > > <object ... >
                            > > > > <img ... onload="alert('SVG not supported')/> </object>
                            > > >
                            > > > I thought you were trying not to rely on script support. j/k ;-)
                            > >
                            > > i still do :-) i was just wondering ...
                            > >
                            > > >
                            > > > > THIS DOES NOT WORK !
                            > > > > the onload allways gets fired. is this right? do html clients
                            > > > > allways load both the objects content and the alternate
                            > content ?
                            > > > > is there another event that can be used ? is there any other
                            > > > > specified way to determin if object renders the
                            > original content
                            > > > > or the
                            > > alternate
                            > > > > content ?
                            > > >
                            > > > Hmm, I'm not sure. That the onload get's evaluated seems
                            > like a bug
                            > > to me.
                            > >
                            > > yeah it seems strange but at least mozilla, opera and ie
                            > agree on the
                            > > behaviour :-) so even if mozilla would get this right, it
                            > would be as
                            > > useless as contentDocument for cross browser detection of
                            > svg support.
                            > >
                            > > thanks for your comments anyways
                            > > Holger
                            > >
                            > i dont know what ive tested last time, but this indeed seems
                            > to work in IE and Opera, so this is probably a bug in
                            > mozilla, in which component would i post this bug ?
                            >
                            > Holger
                            >
                            >
                            >
                            >
                            > -----
                            > To unsubscribe send a message to:
                            > svg-developers-unsubscribe@yahoogroups.com
                            > -or-
                            > visit http://groups.yahoo.com/group/svg-developers and click
                            > "edit my membership"
                            > ----
                            > Yahoo! Groups Links
                            >
                            >
                            >
                            >
                            >
                            >
                            >
                            >
                          • Jonathan Watt
                            Hi Mark, You re quite right of course. This would be the *real* way to do it, and Mozilla happily returns true for both tests. Opera doesn t support scripting
                            Message 13 of 23 , Jul 28, 2005
                            • 0 Attachment
                              Hi Mark,

                              You're quite right of course. This would be the *real* way to do it,
                              and Mozilla happily returns true for both tests. Opera doesn't support
                              scripting of SVG (yet) I believe, so the test won't work for it, but
                              as far as *script* testing goes this is definately the way to do it.

                              Thanks!
                              Jonathan


                              On 7/28/05, Mark Birbeck <Mark.Birbeck@...> wrote:
                              > Dear all,
                              >
                              > We shouldn't really have to check for the existence of methods, etc. An HTML
                              > DOM that can have SVG inline should really return true for one of:
                              >
                              > document.implementation.hasFeature("org.w3c.dom.svg", "1.0")
                              >
                              > or:
                              >
                              >
                              > document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#SVG",
                              > "1.1")
                              >
                              > I haven't tried it, but I would say that's what Opera and Mozilla _should_
                              > provide (and may well do).
                              >
                              > Regards,
                              >
                              > Mark
                            • Jonathan Watt
                              I m told that we are doing the right thing, and that not render doesn t mean not parse . Alternative content should still appear in the DOM as usual, and
                              Message 14 of 23 , Jul 28, 2005
                              • 0 Attachment
                                I'm told that we are doing the right thing, and that "not render"
                                doesn't mean "not parse". Alternative content should still appear in
                                the DOM as usual, and any <img> elements should have their content
                                loaded. Hence the onload should fire. It seems a bit counter to what
                                you'd expect, but there you go.

                                On 7/28/05, Holger Will <holger@...> wrote:
                                > i dont know what ive tested last time, but this indeed seems to work in
                                > IE and Opera, so this is probably a bug in mozilla,
                                > in which component would i post this bug ?
                              • Mark Birbeck
                                Jonathan, ... That s excellent news. I hadn t tried it, but that s good to hear. We ve also (almost) got the same thing working in our Sidewinder Viewer, so
                                Message 15 of 23 , Jul 29, 2005
                                • 0 Attachment
                                  Jonathan,

                                  > ... and Mozilla happily returns true for both tests.

                                  That's excellent news. I hadn't tried it, but that's good to hear.

                                  We've also (almost) got the same thing working in our Sidewinder Viewer, so
                                  hopefully this can become a general test that will indicate that you can
                                  simply send XHTML with inline SVG (and of course there will be equivalent
                                  tests for MathML, XForms and so on).

                                  The next step is obviously to pack the same info into the MIME type, but
                                  that's another story.
                                  Regards,

                                  Mark


                                  Mark Birbeck
                                  CEO
                                  x-port.net Ltd.

                                  e: Mark.Birbeck@...
                                  t: +44 (0) 20 7689 9232
                                  w: http://www.formsPlayer.com/
                                  b: http://internet-apps.blogspot.com/

                                  Download our XForms processor from
                                  http://www.formsPlayer.com/
                                • Holger Will
                                  ... your are right, that sounds plausible, no matter if its visible or not it must be part of the dom, otherwise i would nt be able to change the alternate
                                  Message 16 of 23 , Jul 29, 2005
                                  • 0 Attachment
                                    Jonathan Watt schrieb:

                                    > I'm told that we are doing the right thing, and that "not render"
                                    > doesn't mean "not parse". Alternative content should still appear in
                                    > the DOM as usual, and any <img> elements should have their content
                                    > loaded. Hence the onload should fire. It seems a bit counter to what
                                    > you'd expect, but there you go.

                                    your are right, that sounds plausible, no matter if its visible or not
                                    it must be part of the dom, otherwise i would'nt be able to change the
                                    alternate content via script.
                                    Marks solution seems like the cleanest . i will probably use this
                                    approach, if i need to test via script.

                                    cheers
                                    Holger

                                    >
                                    > On 7/28/05, Holger Will <holger@...> wrote:
                                    > > i dont know what ive tested last time, but this indeed seems to work in
                                    > > IE and Opera, so this is probably a bug in mozilla,
                                    > > in which component would i post this bug ?
                                    >
                                  • Martin Honnen
                                    ... But Mozilla gives true whether the preference svg.enabled is true or not so currently the check Mark suggested does not help with Mozilla trunk builds. I
                                    Message 17 of 23 , Jul 29, 2005
                                    • 0 Attachment
                                      --- In svg-developers@yahoogroups.com, Jonathan Watt <wattie@g...> wrote:

                                      > You're quite right of course. This would be the *real* way to do it,
                                      > and Mozilla happily returns true for both tests.

                                      But Mozilla gives true whether the preference svg.enabled is true or
                                      not so currently the check Mark suggested does not help with Mozilla
                                      trunk builds.
                                      I think that is a bug and have filed
                                      <https://bugzilla.mozilla.org/show_bug.cgi?id=302640>
                                    • Jim Ley
                                      Jonathan Watt wrote in message news:f21dbbd705072817234af897e9@mail.gmail.com... ... BUG! It should not return true for either, as it has
                                      Message 18 of 23 , Aug 2 3:16 AM
                                      • 0 Attachment
                                        "Jonathan Watt" <wattie@...> wrote in message
                                        news:f21dbbd705072817234af897e9@......
                                        > Hi Mark,
                                        >
                                        > You're quite right of course. This would be the *real* way to do it,
                                        > and Mozilla happily returns true for both tests.

                                        BUG! It should not return true for either, as it has not implemented
                                        either, I'll raise a bug when I have some internet access...

                                        > Opera doesn't support
                                        > scripting of SVG (yet) I believe, so the test won't work for it, but
                                        > as far as *script* testing goes this is definately the way to do it.

                                        Definately not, no user agent should be returning true for DOMImplementation
                                        tests unless they have actually implemented the specification - ie their
                                        implementation meets all the conformance requirements, since such a beast is
                                        unlikely to exist in our lifetimes, we should not bother testing for it, and
                                        UA's returning true prematurely has already made the tests useless as it
                                        will be no discriminator even if it does exist one day.

                                        As you've shown heuristic methods can be used, and these are much more
                                        useful as they can just test the features of the language that we actually
                                        use, it doesn't matter to me if you've not authored some feature if I don't
                                        actually use it.

                                        Cheers,

                                        Jim.
                                      • Mark Birbeck
                                        Jim, But as you know, the SVG spec defines a large number of possible values to test for with DOMImplementation, not just do you have SVG? . So ideally we
                                        Message 19 of 23 , Aug 2 5:39 AM
                                        • 0 Attachment
                                          Jim,

                                          But as you know, the SVG spec defines a large number of possible values to
                                          test for with DOMImplementation, not just "do you have SVG?". So ideally we
                                          should be able to test for the language features we want, without using
                                          hacks (sorry, I mean heuristic methods).

                                          Regards,

                                          Mark


                                          Mark Birbeck
                                          CEO
                                          x-port.net Ltd.

                                          e: Mark.Birbeck@...
                                          t: +44 (0) 20 7689 9232
                                          w: http://www.formsPlayer.com/
                                          b: http://internet-apps.blogspot.com/

                                          Download our XForms processor from
                                          http://www.formsPlayer.com/

                                          > -----Original Message-----
                                          > From: svg-developers@yahoogroups.com
                                          > [mailto:svg-developers@yahoogroups.com] On Behalf Of Jim Ley
                                          > Sent: 02 August 2005 11:16
                                          > To: svg-developers@yahoogroups.com
                                          > Subject: [svg-developers] Re: Re: Detect native SVG support
                                          >
                                          >
                                          > "Jonathan Watt" <wattie@...> wrote in message
                                          > news:f21dbbd705072817234af897e9@......
                                          > > Hi Mark,
                                          > >
                                          > > You're quite right of course. This would be the *real* way
                                          > to do it,
                                          > > and Mozilla happily returns true for both tests.
                                          >
                                          > BUG! It should not return true for either, as it has not
                                          > implemented either, I'll raise a bug when I have some
                                          > internet access...
                                          >
                                          > > Opera doesn't support
                                          > > scripting of SVG (yet) I believe, so the test won't work
                                          > for it, but
                                          > > as far as *script* testing goes this is definately the way to do it.
                                          >
                                          > Definately not, no user agent should be returning true for
                                          > DOMImplementation tests unless they have actually implemented
                                          > the specification - ie their implementation meets all the
                                          > conformance requirements, since such a beast is unlikely to
                                          > exist in our lifetimes, we should not bother testing for it,
                                          > and UA's returning true prematurely has already made the
                                          > tests useless as it will be no discriminator even if it does
                                          > exist one day.
                                          >
                                          > As you've shown heuristic methods can be used, and these are
                                          > much more useful as they can just test the features of the
                                          > language that we actually use, it doesn't matter to me if
                                          > you've not authored some feature if I don't actually use it.
                                          >
                                          > Cheers,
                                          >
                                          > Jim.
                                          >
                                          >
                                          >
                                          >
                                          >
                                          > ------------------------ Yahoo! Groups Sponsor
                                          > --------------------~--> <font face=arial size=-1><a
                                          > href="http://us.ard.yahoo.com/SIG=12hts36l6/M=362131.6882499.7
                                          > 825260.1510227/D=groups/S=1706030389:TM/Y=YAHOO/EXP=1122992505
                                          > /A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
                                          > ">Get Bzzzy! (real tools to help you find a job) Welcome to
                                          > the Sweet Life - brought to you by One Economy</a>.</font>
                                          > --------------------------------------------------------------
                                          > ------~->
                                          >
                                          > -----
                                          > To unsubscribe send a message to:
                                          > svg-developers-unsubscribe@yahoogroups.com
                                          > -or-
                                          > visit http://groups.yahoo.com/group/svg-developers and click
                                          > "edit my membership"
                                          > ----
                                          > Yahoo! Groups Links
                                          >
                                          >
                                          >
                                          >
                                          >
                                          >
                                          >
                                          >
                                          >
                                        • Jim Ley
                                          Mark Birbeck wrote in message news:B841AC96-C2B4-4799-869D-9852793297AE@S009... ... Right, so we agree that Mozilla SVG and
                                          Message 20 of 23 , Aug 2 10:29 AM
                                          • 0 Attachment
                                            "Mark Birbeck" <Mark.Birbeck@...> wrote in message
                                            news:B841AC96-C2B4-4799-869D-9852793297AE@S009...
                                            >But as you know, the SVG spec defines a large number of possible values to
                                            >test for with DOMImplementation, not just "do you have SVG?". So ideally we
                                            >should be able to test for the language features we want, without using
                                            >hacks (sorry, I mean heuristic methods).

                                            Right, so we agree that Mozilla SVG and SideWinder would be non-conformant
                                            and incorrect if they return true for http://www.w3.org/TR/SVG11/feature#SVG
                                            since they don't fulfill any of the sub ones.

                                            Do they fulfil any of the sub-ones, I believe not, because to claim that
                                            they do, they have to meet:

                                            ... the viewer can process and render successfully all of the language
                                            features ...

                                            Since they contain bugs and partial implementations, they should not claim
                                            any of the features. Of course this problem is common to the entire feature
                                            string concept across all languages, but that's just unfortunate that it
                                            ever became a specifcation.

                                            The HTML scripting world has shown how heuristic methods are extremely
                                            successful in dealing with different implementations, no-one uses the
                                            DOMImplementation interface, it's simply not acceptable due to the wild
                                            claims of some browsers (claiming support before there was only partial
                                            support) and the overly-prudent claims of others (claiming no-support when
                                            there was pretty good support)

                                            Cheers,

                                            Jim.
                                          • Mark Birbeck
                                            Jim, Sidewinder wouldn t be conformant or non-conformant. We just pass a call to the methods on a DOMImplementation to the implementations that we ve
                                            Message 21 of 23 , Aug 2 10:59 AM
                                            • 0 Attachment
                                              Jim,

                                              Sidewinder wouldn't be conformant or non-conformant. We just pass a call to
                                              the methods on a DOMImplementation to the implementations that we've
                                              instantiated to create that implementation. In the case of an object that
                                              'supports' SVG it would most likely be ASV (although it would depend on the
                                              user's machine). So whether ASV (or whatever SVG plug-in is in use) is
                                              non-conformant for claiming to support whatever feature strings it claims to
                                              support, is something that I couldn't answer.

                                              As to adding more and more hacks, no one doubts that you can keep adding
                                              another line of script to test for yet another permutation. But as the world
                                              of compound documents gets closer, don't you think that there needs to be a
                                              generic solution that allows for testing not just for SVG, but for MathML,
                                              XForms and so on? I recognise your criticisms of DOMImplementation, but at
                                              some point we do need it to work...or rather it needs to be made to work.

                                              All the best,

                                              Mark


                                              Mark Birbeck
                                              CEO
                                              x-port.net Ltd.

                                              e: Mark.Birbeck@...
                                              t: +44 (0) 20 7689 9232
                                              w: http://www.formsPlayer.com/
                                              b: http://internet-apps.blogspot.com/

                                              Download our XForms processor from
                                              http://www.formsPlayer.com/

                                              > -----Original Message-----
                                              > From: svg-developers@yahoogroups.com
                                              > [mailto:svg-developers@yahoogroups.com] On Behalf Of Jim Ley
                                              > Sent: 02 August 2005 18:30
                                              > To: svg-developers@yahoogroups.com
                                              > Subject: [svg-developers] Re: Detect native SVG support
                                              >
                                              >
                                              > "Mark Birbeck" <Mark.Birbeck@...> wrote in message
                                              > news:B841AC96-C2B4-4799-869D-9852793297AE@S009...
                                              > >But as you know, the SVG spec defines a large number of
                                              > possible values
                                              > >to test for with DOMImplementation, not just "do you have SVG?". So
                                              > >ideally we should be able to test for the language features we want,
                                              > >without using hacks (sorry, I mean heuristic methods).
                                              >
                                              > Right, so we agree that Mozilla SVG and SideWinder would be
                                              > non-conformant and incorrect if they return true for
                                              > http://www.w3.org/TR/SVG11/feature#SVG
                                              > since they don't fulfill any of the sub ones.
                                              >
                                              > Do they fulfil any of the sub-ones, I believe not, because to
                                              > claim that they do, they have to meet:
                                              >
                                              > ... the viewer can process and render successfully all of the
                                              > language features ...
                                              >
                                              > Since they contain bugs and partial implementations, they
                                              > should not claim any of the features. Of course this problem
                                              > is common to the entire feature string concept across all
                                              > languages, but that's just unfortunate that it ever became a
                                              > specifcation.
                                              >
                                              > The HTML scripting world has shown how heuristic methods are
                                              > extremely successful in dealing with different
                                              > implementations, no-one uses the DOMImplementation interface,
                                              > it's simply not acceptable due to the wild claims of some
                                              > browsers (claiming support before there was only partial
                                              > support) and the overly-prudent claims of others (claiming
                                              > no-support when there was pretty good support)
                                              >
                                              > Cheers,
                                              >
                                              > Jim.
                                              >
                                              >
                                              >
                                              >
                                              >
                                              > ------------------------ Yahoo! Groups Sponsor
                                              > --------------------~--> <font face=arial size=-1><a
                                              > href="http://us.ard.yahoo.com/SIG=12hlnqdd7/M=362131.6882499.7
                                              > 825260.1510227/D=groups/S=1706030389:TM/Y=YAHOO/EXP=1123011190
                                              > /A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
                                              > ">Get Bzzzy! (real tools to help you find a job) Welcome to
                                              > the Sweet Life - brought to you by One Economy</a>.</font>
                                              > --------------------------------------------------------------
                                              > ------~->
                                              >
                                              > -----
                                              > To unsubscribe send a message to:
                                              > svg-developers-unsubscribe@yahoogroups.com
                                              > -or-
                                              > visit http://groups.yahoo.com/group/svg-developers and click
                                              > "edit my membership"
                                              > ----
                                              > Yahoo! Groups Links
                                              >
                                              >
                                              >
                                              >
                                              >
                                              >
                                              >
                                              >
                                              >
                                            • Jim Ley
                                              Mark Birbeck wrote in message news:126DE715-5318-467A-A2D7-79A6CE931AE1@S009... ... I would still call SideWinder non-conformant,if
                                              Message 22 of 23 , Aug 2 12:19 PM
                                              • 0 Attachment
                                                "Mark Birbeck" <Mark.Birbeck@...> wrote in message
                                                news:126DE715-5318-467A-A2D7-79A6CE931AE1@S009...

                                                >Sidewinder wouldn't be conformant or non-conformant. We just pass a call to
                                                >the methods on a DOMImplementation to the implementations that we've
                                                >instantiated to create that implementation.

                                                I would still call SideWinder non-conformant,if its underlying
                                                implementation was non-conformant, just like I call IE non-HTTP conformant
                                                when it's simply using an underlying HTTP implementation, and of course it
                                                certainly wouldn't be your fault, you're absolutely right to be re-using
                                                components.

                                                > But as the world
                                                >of compound documents gets closer, don't you think that there needs to be a
                                                >generic solution that allows for testing not just for SVG, but for MathML,
                                                >XForms and so on?

                                                Absolutely, but DOMImplementation is not it, I'm not sure what it would look
                                                like, indeed I've tried thinking of something before, as the criticisms of
                                                DOM Implementation are not new, but I've never come up with anything, 'nor
                                                heard of anything.

                                                Cheers,

                                                Jim.
                                              • Bjoern Hoehrmann
                                                ... I certainly agree. Such facilities aren t cheap though, you need * Very clear well-defined conformance requirements * Extensive test suites for these
                                                Message 23 of 23 , Aug 2 1:11 PM
                                                • 0 Attachment
                                                  * Mark Birbeck wrote:
                                                  >As to adding more and more hacks, no one doubts that you can keep adding
                                                  >another line of script to test for yet another permutation. But as the world
                                                  >of compound documents gets closer, don't you think that there needs to be a
                                                  >generic solution that allows for testing not just for SVG, but for MathML,
                                                  >XForms and so on? I recognise your criticisms of DOMImplementation, but at
                                                  >some point we do need it to work...or rather it needs to be made to work.

                                                  I certainly agree. Such facilities aren't cheap though, you need

                                                  * Very clear well-defined conformance requirements
                                                  * Extensive test suites for these facilities
                                                  * Strong commitment to 100% compliance
                                                  * Strong and reliable means to enforce compliance

                                                  At the moment, for SVG feature strings, we don't have any of that. In
                                                  fact, it's probably worse, there are still many authors who do not care
                                                  at all even about most basic conformance requirements like using well-
                                                  formed XML; many authors still think "We usually find checking with
                                                  [IE, Opera and Firefox] is enough for our work". If we can't convince
                                                  authors to ensure their content is conforming, there is little hope to
                                                  convince implementers to code correctly.
                                                  --
                                                  Björn Höhrmann · mailto:bjoern@... · http://bjoern.hoehrmann.de
                                                  Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
                                                  68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
                                                Your message has been successfully submitted and would be delivered to recipients shortly.