ATHENA's profile闲人勿入BlogListsGuestbookMore Tools Help

Blog


    判断是否安装某个控件,插件

    不是每个都可以,不知道为什么有的不行,比如RealPlayer的ActiveX就不行,有待研究。
     
    <script>
    function isInsalled(oID){
    with(event.srcElement){//给事件发生的对象添加clientCaps默认行为
    addBehavior(’#default#clientcaps’)                 
    //根据控件的ID检测是否已经安装,是的话继续检测控件版本,否则提示"未安装"
    isComponentInstalled(oID,"componentid")?alert(’已安装,版本:’+getComponentVersion(oID,"componentid")):alert("未安装")        
    }}
    </script>
    <button onclick="isInsalled(’{D27CDB6E-AE6D-11cf-96B8-444553540000}’)">Micromedia Flash Player</button>
    <button onclick="isInsalled(’{22d6f312-b0f6-11d0-94ab-0080c74c7e95}’)">Window Media Player</button>
     
    主要是依靠IE的强大的默认行为clientCaps。在单击按钮时调用isInsalled函数,用addBehavior方法给该按钮添加clientCaps行为,然后利用clientCaps行为的isComponentInstalled方法判断指定控件是否已安装,如果已安装,继续用getComponentVersion方法获取已安装的控件版本号。 
    addBehavior 给元素附加一个行为。
    isComponentInstalled 检索指定组件(插件、控件)是否可用。
    getComponentVersion 获取指定组件的版本号。

    Comments

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Trackbacks (1)

    The trackback URL for this entry is:
    http://athenalover.spaces.live.com/blog/cns!9EA68F276E74CDD5!179.trak
    Weblogs that reference this entry