Through the form of JS + FLASH, the browser compatibility problem can be solved perfectly.
Requires files swfobject.js , clipboard.swf , image for display (flash_copy_btn.png). see attached
<span id="forLoadSwf"></span> <script src="{$domain}static/swfobject.js" type="text/javascript"></script> <script type="text/javascript"> var copyCon = "343"; var flashvars = { content: encodeURIComponent(copyCon), uri: '{$domain}static/flash_copy_btn.png' }; var params = wmode: "transparent", allowScriptAccess: "always" }; swfobject.embedSWF("{$domain}static/clipboard.swf", "forLoadSwf", "52", "25", "9.0.0", null, flashvars, params); function copySuccess(){ //flash callback alert("Copy successfully!"); } </script>