Hey all, I'm trying to implant something in my blog and i hope you can help me. I want my readers to have the option to click a button \ link like the trackback one and that the post link - URL will be automatically copied to their clipboard (like you see on imageshack, photobucket, TinyPic etc') I've managed to find a code that does just that but its written in javascript. Due to today security in browsers you need to use a swf file in order for it to work. Here's the code: function copy(inElement) { if (inElement.createTextRange) { var range = inElement.createTextRange(); if (range && BodyLoaded==1) range.execCommand('Copy'); } else { var flashcopier = 'flashcopier'; if(!document.getElementById(flashcopier)) { var divholder = document.createElement('div'); divholder.id = flashcopier; document.body.appendChild(divholder); } document.getElementById(flashcopier).innerHTML = ''; var divinfo = '<embed src="_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(inElement.value)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>'; document.getElementById(flashcopier).innerHTML = divinfo; } } Code (markup): and the swf file: hxxp://www.jeffothy.com/weblog/uploads/clipboard.php how can i use the script above to copy my current url? Thanks
i'll make it easier to understand what im after. i want to change this html that instead of the text element the script "copy" will copy to the clipboard the current URL. I've tried to call it with location.href but with no luck. <form name="formtocopy" action=""> <textarea name="texttocopy"> A whole bunch of text here that will be copied. </textarea> <br> <a href="javascript:copy(document.formtocopy.texttocopy);">copy</a> </form> Code (markup):