JS get browser user information and create different versions of Flash components

Source: Internet
Author: User

This is a use of the code in the Flash site, he is using JS to obtain browser user information and then create a different version of the Flash component instances, so good compatible with most of the mainstream browser OK.
*/
var Isie = (Navigator.appversion.indexof ("MSIE")!=-1)? True:false;

var Iswin = (Navigator.appversion.tolowercase (). indexof ("Win")!=-1)? True:false;

var Isopera = (Navigator.useragent.indexof ("opera")!=-1)? True:false;

function Controlversion ()

{

var version;

var Axo;

var e;

Note:new ActiveXObject (Strfoo) throws a exception if Strfoo isn ' t in the registry

try {

Version'll is set for 7.x or greater players

Axo = new ActiveXObject ("shockwaveflash.shockwaveflash.7");

Version = Axo.getvariable ("$version");

catch (e) {

}

if (!version)

{

try {

Version'll is set for 6.x players only

Axo = new ActiveXObject ("shockwaveflash.shockwaveflash.6");

Installed player is some revision of 6.0

GetVariable ("$version") crashes for versions 6.0.22 through 6.0.29,

So we have to be careful.

Default to the

Version = "Win 6,0,21,0";

Throws if Allowscripaccess does not exist (introduced in 6.0r47)

Axo.allowscriptaccess = "Always";

Safe to call for 6.0r47 or greater

Version = Axo.getvariable ("$version");

catch (e) {

}

}

if (!version)

{

try {

Version'll is set for 4.x or 5.x player

Axo = new ActiveXObject ("shockwaveflash.shockwaveflash.3");

Version = Axo.getvariable ("$version");

catch (e) {

}

}

if (!version)

{

try {

Version'll is set for 3.x player

Axo = new ActiveXObject ("shockwaveflash.shockwaveflash.3");

Version = "Win 3,0,18,0";

catch (e) {

}

}

if (!version)

{

try {

Version'll is set for 2.x player

Axo = new ActiveXObject ("Shockwaveflash.shockwaveflash");

Version = "Win 2,0,0,11";

catch (e) {

Version =-1;

}

}

return version;

}
</script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.