Forum Moderators: open
I'm able to do this, but I get promoted saying the script is trying to access the clipboard in IE7, and I presume other browsers as well.
I imagine that's because there is a possible security risk in being able to copy information the user already has in their clipboard.
Is there a way to rewrite the code where it can only write content to the clipboard without getting that warning prompt from the browser?
Thanks
<input type="text" onfocus="javascript:this.select();field=this.createTextRange();field.execCommand('Copy');" value="copy this" />
As far as your code is concerned, are you aware that your code only works for IE and not for other browsers such as Mozilla? In case you aren't, if you do a quick google search you'll find some solutions that are a little more cross-browser compatible.