Hi. I use this code for IE/ASV and Firefox:

<!-- script to check SVG availability and version -->
<!-- MOST OF THIS IS FROM SUN and another guy I don't
remember. Sorry. -->
<!-- Check if browsers have SVG support and record if
we need to use
         VBScript detection method if the number of MIME
types is 0. -->
<script language="JavaScript1.1">
        // Variable to keep track of user's SVG support
        var hasSVGSupport = false;
        var svgVersion;
        var svgCtl;

        // Variable to indicate whether we need to use
VBScript method to
        // detect SVG support
        var useVBMethod = false;

        // Internet Explorer returns 0 as the number of MIME
types,
        // so this code will not be executed by it. This is
our indication
        // to use VBScript to detect SVG support.
        if (navigator.mimeTypes != null &&
navigator.mimeTypes.length > 0) {

                var plugin = 0;
                
                if (navigator.mimeTypes &&
navigator.mimeTypes["image/svg+xml"]){
                        plugin =
navigator.mimeTypes["image/svg+xml"].enabledPlugin;
                }
                        
                if (plugin) {
                        hasSVGSupport = true;
                        svgVersion = plugin.description;
                }
                else{
                        // Firefox 1.5+ has SVG native support. Checking
with a user agent match.
                        // If there is a more refined way to do this,
please tell me.
                        
                        var xua = window.navigator.userAgent;
                        var xpos_firefox =
xua.toLowerCase().indexOf('firefox');

                        if(xpos_firefox != -1){
                                
                                xversion =
xua.substr(xpos_firefox).split('/')[1].split('.');

                                var xnum_ver = parseInt(xversion[0]) * 100 +
parseInt(xversion[1]);
                                
                                if(xnum_ver >= 105){
                                        hasSVGSupport = true;
                                        svgVersion = xversion.join('.');
                                }
                        }
                }
        } 
        else {
                useVBMethod = true;
        }
</script>

<!-- Visual Basic Script to detect support of Adobe
SVG plugin. This
         code is not run on browsers which report they have
MIME types, and
         it is also not run by browsers which do not have
VBScript support.
 -->
<script language="VBScript">
        On Error Resume Next
        If useVBMethod = true Then
                Set svgCtl  = CreateObject("Adobe.SVGCtl")
                svgVersion = svgCtl.getSVGViewerVersion()
                hasSVGSupport = IsObject(svgCtl)
        End If
</script>


<SCRIPT language="JavaScript1.2">
        if (!hasSVGSupport) {
                location.href =
location.href.replace(location.href.split('/').pop(),
'error_plugin_svg.htm');
        }
        else{ //that is only for testing:
                alert('SVG SUPPORT!\nsvgVersion: ' + svgVersion);
        }
</script>

I hope this help you.


 --- Nikolya Patskov <[EMAIL PROTECTED]> escribió:

> Hi all. How can I get version SVG viewer using
> JavaScript?
> Nikolya
> 
> 
> 
> 
> 


__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.espanol.yahoo.com/ 


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/I258zB/QnQLAA/TtwFAA/1U_rlB/TM
--------------------------------------------------------------------~-> 

-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to