test for VML

V

VK

Andrew said:
How can I detect whether VML is supported?

IE 5.5 or higher is the only one with VML support, so that's easy:

<script type="text/javascript">
/*@cc_on @*/
/*@if (@_jscript_version >= 5.5)
var isVML = true
@else @*/
var isVML = false
/*@end @*/

// rest of your code
</script>

This way for IE5.5> isVML will be true, for all other UA's isVML will
be false.

Please not though that IE will not recognize VML tags until you add the
needed namespace to your HTML document. See more at
<http://msdn.microsoft.com/workshop/author/vml/SHAPE/e_shape.asp>
 
A

Andrew Poulos

VK said:
IE 5.5 or higher is the only one with VML support, so that's easy:

<script type="text/javascript">
/*@cc_on @*/
/*@if (@_jscript_version >= 5.5)
var isVML = true
@else @*/
var isVML = false
/*@end @*/

// rest of your code
</script>

This way for IE5.5> isVML will be true, for all other UA's isVML will
be false.

Thanks but a few points:
- I believe VML is supported in IE 5.0 and above.
- Can't VML support be added to non-IE browsers?
- Is testing for the JScript version really a good way to test for VML
support?
[- I didn't know about /*@cc_on @*/ for conditional comments. Is it a
recommended way of scripting?]

Andrew Poulos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top