2014-10-20 82 views
0

这里真的很简单的问题,我找不到它在文档中,希望有人在这里可以指出我在正确的方向。ZeroClipboard - 检查它是否没有加载

https://github.com/zeroclipboard/zeroclipboard

在ZeroClipboard有当SWF加载回调,是有办法,如果它尚未加载我能察觉?

下面是它目前的工作方式时,它的加载:

client.on("ready", function(readyEvent) { 
    // alert("ZeroClipboard SWF is ready!"); 

    client.on("aftercopy", function(event) { 
    // `this` === `client` 
    // `event.target` === the element that was clicked 
    event.target.style.display = "none"; 
    alert("Copied text to clipboard: " + event.data["text/plain"]); 
    }); 
}); 

回答

1

只需选中ZeroClipboard对象是否在窗口存在

window.onload = function() { 
    if (!('ZeroClipboard' in window)) { 
     //your code 
    } 
}