Detect if user has vitalize installed (javascript)
Here is a small javascript I hacked together to test if an user has vitalize installed, might be a smarter way to do it but I don't know... :)
Anyways the code:
Code:
<SCRIPT LANGUAGE="Javascript">
<!--
if(navigator.plugins.length >0 && navigator.plugins["Vitalize!"]){
document.write("User has vitalize <br />" );
}
else {
var ie=new ActiveXObject("ATXVitalize.Vitalize.1");
if(ie){
document.write("User has vitalize <br />" );
}
}
// -->
</SCRIPT>
Happy homepage cooking!
Re: Detect if user has vitalize installed (javascript)
Re: Detect if user has vitalize installed (javascr
Nice. To make your code HTML 4.01 (Strict & Transitional) compliant a developer would need to add type="text/javascript" to the script tag (and presumably use <br> instead of <br />).
An XHTML 1.0 (Strict & Traditional) and 1.1 compliant version would look something like:
Code:
<script type="text/javascript">
//<![CDATA[
if(navigator.plugins.length >0 && navigator.plugins["Vitalize!"]){
document.write("User has vitalize <br />" );
}
else {
var ie=new ActiveXObject("ATXVitalize.Vitalize.1");
if(ie){
document.write("User has vitalize <br />" );
}
}
//]]>
</script>
Re: Detect if user has vitalize installed (javascr
Umm I don't use HTML and stuff like that, so I don't really understand this... Is there a way to make the website display certain text if they do/don't have Vitalize! ?
Re: Detect if user has vitalize installed (javascr
Quote:
<script type="text/javascript">
//<![CDATA[
if(navigator.plugins.length >0 && navigator.plugins["Vitalize!"]){
document.write("You have vitalize");
}
else {
var ie=new ActiveXObject("ATXVitalize.Vitalize.1");
if(ie){
document.write("You have vitalize" );
} else {
document.write("You do not have vitalize");
}
}
//]]>
</script>
Replace the "User has vitalize" and "User does not have vitalize" with whatever you want.
Re: Detect if user has vitalize installed (javascr
Code:
<script type="text/javascript">
//<![CDATA[
if(navigator.plugins.length >0 && navigator.plugins["Vitalize!"]){
document.write("You have vitalize");
}
else if(navigator.plugins.length ==0) {
var ie=new ActiveXObject("ATXVitalize.Vitalize.1");
if(ie){
document.write("You have vitalize" );
}
}
else {
document.write("You do not have vitalize");
}
//]]>
</script>
Updated it a bit, fixes an problem ;)
Re: Detect if user has vitalize installed (javascr
Great, this is a very useful code. :)
Re: Detect if user has vitalize installed (javascr
This code doesn't work under IE6 & 7 but on FireFox ...
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Webpage</title>
</head>
<body>
<script type="text/javascript">
//<![CDATA[
if(navigator.plugins.length >0 && navigator.plugins["Vitalize!"]){
document.write("You have vitalize");
}
else if(navigator.plugins.length ==0) {
var ie=new ActiveXObject("ATXVitalize.Vitalize.1");
if(ie){
document.write("You have vitalize" );
}
}
else {
document.write("You do not have vitalize");
}
//]]>
</script>
</body>
</html>
Re: Detect if user has vitalize installed (javascr
I havn't tested it with out vitalize so I am unsure, but it does work as far as i say that I do have it on ie6-8.. I will take a test run with out having vitalize installed when I get the time...
Re: Detect if user has vitalize installed (javascr
in fact, in IE6 & IE7, I have no text!
Re: Detect if user has vitalize installed (javascr
Thats odd it works for me :S and you have javascript turned on? it should at least display that you dont have it, thats the last thing is does....
Re: Detect if user has vitalize installed (javascr
Quote:
Originally Posted by Villy
Thats odd it works for me :S and you have javascript turned on?
Yes, it's odd, the javascript is turned on ... :(
Re: Detect if user has vitalize installed (javascr
It doesn't work in IE6 because it sometimes makes you press a little bar at the top to enable Active X. "To help protect your security, Internet Explorer has restricted this file from showing active content that could access your computer. Click here for options..."
I think it only usually does that if you are in the local zone (running the file from your PC) or have security set to 'high'. If you are running the file from My Computer you can fix this by going to Tools->Internet Options->Advanced and checking the "Allow active content to run in files on My Computer" option.
Re: Detect if user has vitalize installed (javascr
Then it should fail(as in reporting that the pc doesnt have v!) - because the javascript doesnt get to create the activex :S
Re: Detect if user has vitalize installed (javascr
Quote:
Originally Posted by Villy
Then it should fail(as in reporting that the pc doesnt have v!) - because the javascript doesnt get to create the activex :S
It won't fail if its running from My Computer because JavaScript (which is "active content") won't run either. You'd need a <noscript> or something.
Re: Detect if user has vitalize installed (javascr
Re: Detect if user has vitalize installed (javascr
Try this:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Webpage</title>
</head>
<body>
<script type="text/javascript">
//<![CDATA[
if(navigator.plugins.length >0 && navigator.plugins["Vitalize!"]){
document.write("You have vitalize");
}
else if(navigator.plugins.length ==0) {
var ie=new ActiveXObject("ATXVitalize.Vitalize.1");
if(ie){
document.write("You have vitalize" );
}
}
else {
document.write("You do not have vitalize");
}
//]]>
</script>
<noscript>
JavaScript is either not enabled or not supported.
</noscript>
</body>
</html>
Re: Detect if user has vitalize installed (javascr
Great! it works but ...
When Vitalize is installed:
> Firefox shows "You have vitalize"
> IE shows 1st "JavaScript is either not enabled or not supported." and I click on yellow tab, IE shows "You have vitalize"
When Vitalize is not installed:
> Firefox shows "You do not have vitalize"
> IE shows 1st "JavaScript is either not enabled or not supported." and I click on yellow tab, IE shows nothing :(
Re: Detect if user has vitalize installed (javascr
Hmm, try this:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Webpage</title>
</head>
<body>
<script type="text/javascript">
//<![CDATA[
if(navigator.plugins.length >0 && navigator.plugins["Vitalize!"]){
document.write("You have vitalize");
}
else if(navigator.plugins.length ==0) {
var ie=new ActiveXObject("ATXVitalize.Vitalize.1");
if(ie){
document.write("You have vitalize" );
}
else{
document.write("You do not have vitalize");
}
}
else {
document.write("You do not have vitalize");
}
//]]>
</script>
<noscript>
JavaScript is either not enabled or not supported.
</noscript>
</body>
</html>
Re: Detect if user has vitalize installed (javascr
Re: Detect if user has vitalize installed (javascr
Quote:
Originally Posted by Nico
still doesn't works :(
Explain the behaviour.
Re: Detect if user has vitalize installed (javascr
Same, when Vitalize is not installed:
> Firefox shows "You do not have vitalize"
> IE shows 1st "JavaScript is either not enabled or not supported." and I click on yellow tab, IE shows nothing :(