Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-18-2005, 06:45 PM
hommealone's Avatar
WebProWorld Pro
 

Join Date: Feb 2004
Location: Kingston, NY USA
Posts: 107
hommealone RepRank 0
Default javascript for "copy highlighted text"?

Does anyone know of a javascript that would copy (already) highlighted text to your clipboard? Maybe by pushing a button? I've searched, and only found one, and that one works only with IE.

Anyone here know of one?
Reply With Quote
  #2 (permalink)  
Old 02-24-2005, 08:09 AM
paulhiles's Avatar
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: UK
Posts: 2,803
paulhiles RepRank 0
Default Copy to clipboard in Javascript

Hmmm... There are lots of ways to do this in IE!
Mozilla is not quite as accommodating, mostly due to it's superior security, the only Javascript solutions I've seen involve altering the configuration of the browser, so not really suitable for casual visitors.

Check out the links below if you're still interested
http://www.krikkit.net/howto_javascr...clipboard.html
Copy to clipboard [Experts Exchange]

Paul
Reply With Quote
  #3 (permalink)  
Old 02-24-2005, 12:30 PM
hommealone's Avatar
WebProWorld Pro
 

Join Date: Feb 2004
Location: Kingston, NY USA
Posts: 107
hommealone RepRank 0
Default

Thanks, Paul. Not the answer I was hoping for, but I'll deal with it.

Quote:
not really suitable for casual visitors.
So those solutions don't cover the 5%-or-whatever of people using Mozilla browsers, but only the sub-fraction of those who have modified the settings of their Mozilla browsers. Yeah, you're right that this won't be the answer to my question.

I guess that there is no good solution, so my resolution of this, I suppose, will simply be to not worry about it. I'm just going to use a script that works for IE, and include an alert notification for non-IE users telling them that it doesn't work without IE:

Code:
function sendToClipboard(s)
{
if( window.clipboardData && clipboardData.setData )
{
clipboardData.setData("Text", s);
}
else
{
alert("Internet Explorer required");
}
}

<body>
<input type="button" value="Copy to Clipboard" onclick="sendToClipboard(document.getElementById('textareaIDgoes here').innerHTML)" />
</body>
Thanks much for your reply! I appreciate it.
- Paul
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: , , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0