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

Detecting Firefox with Javascript

Expand Messages
  • brucerindahl
    I have a script that navigates through an SVG document and replaces all images tags that use SVG content with the actual SVG file via XMLHTTPRequest. This
    Message 1 of 3 , Mar 30, 2008
    View Source
    • 0 Attachment
      I have a script that navigates through an SVG document and replaces
      all images tags that use SVG content with the actual SVG file via
      XMLHTTPRequest. This allows using SVG files in images in Firefox. I
      have a detection function that is kind of a hack like this:

      if(typeof navigator != undefined) {
      var agent = navigator.userAgent;
      if (agent != null && agent.search(/Gecko/) > 1) {
      SVGImage(document);
      }
      }

      SVGImage is the function that replaces all the image tags using SVG
      with the referenced files.

      This function throws an exception in Batik. Is there a better way to
      detect Firefox?

      Bruce Rindahl
    • Helder Magalhães
      ... There s a recent, very similar, post at the Batik mailing list [1] which I ve just replied to. (Note that may be some delay before the message is actually
      Message 2 of 3 , Mar 31, 2008
      View Source
      • 0 Attachment
        > if(typeof navigator != undefined) {
        > var agent = navigator.userAgent;
        > if (agent != null && agent.search(/Gecko/) > 1) {
        > SVGImage(document);
        > }
        > }
        > This function throws an exception in Batik. Is there a better way to
        > detect Firefox?

        There's a recent, very similar, post at the Batik mailing list [1]
        which I've just replied to.

        (Note that may be some delay before the message is actually published.)

        Regards,

        Helder Magalhães

        [1]http://www.nabble.com/exception-with-setTimeout----detecting-SVG-viewer-implementation-td16373375.html#a16373375
      • brucerindahl
        Thanks! That works better. I agree with the comments on browser detection, however in this case I don t think it will work. Mozilla does support the image
        Message 3 of 3 , Mar 31, 2008
        View Source
        • 0 Attachment
          Thanks!
          That works better. I agree with the comments on browser detection,
          however in this case I don't think it will work. Mozilla does support
          the image tag - just not with an SVG source.
          Bruce

          --- In svg-developers@yahoogroups.com, Helder Magalhães
          <helder.magalhaes@...> wrote:
          >
          > > if(typeof navigator != undefined) {
          > > var agent = navigator.userAgent;
          > > if (agent != null && agent.search(/Gecko/) > 1) {
          > > SVGImage(document);
          > > }
          > > }
          > > This function throws an exception in Batik. Is there a better way to
          > > detect Firefox?
          >
          > There's a recent, very similar, post at the Batik mailing list [1]
          > which I've just replied to.
          >
          > (Note that may be some delay before the message is actually published.)
          >
          > Regards,
          >
          > Helder Magalhães
          >
          >
          [1]http://www.nabble.com/exception-with-setTimeout----detecting-SVG-viewer-implementation-td16373375.html#a16373375
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.