views:

364

answers:

4

Is it possible to have JUST TEXT copied when a user copies a url from a webpage to an HTML-enabled application such as Word of Outlook? Perhaps there is something I can do in Javascript? I know how to disable Copy + Paste completely, but I really need to disable HTML copying only.

Thank you very much.

+1  A: 

In Word at least, you can Paste as plain text--Right click, Paste as Special... and select Unformatted. Maybe Outlook has that feature, too?

Not sure if you can change how the web browser is copying the text to the clipboard, though.

Adam DiCarlo
Thanks! Unfortunately I am trying to do this on the web to prevent users from finding out the url when copying and pasting. I am not sure if it's possible, but it would be really great if I could do that.
if you're trying to hide a URL, you're probably doing something wrong. I'm guessing you're hoping this will give you some sort of "security". The URL must be known to the user's browser in order for it to function, and you have no control over the browser -- it can do anything, and can't be trusted. Your security is doomed to fail if this is how you're doing it.
rmeador
A: 

It doesn't answer your question, but PureText addresses this problem handsomely.

lance
A: 

I don't think you can as the Hyperlink is copied as plain text and Word and Office then format that plain text into a hyperlink.

Do this: open Notepad. Type in a hyperlink, paste it into Outlook, and press Enter. Nothing you can do.

EDIT

If it is possible, set a function on the onload that checks for when something is copied and overwrite it. Here is a javascript function to Copy to the Clipboard:

http://www.dynamic-tools.net/toolbox/copyToClipboard/

Martin
Thanks, but I think the HTML gets copied as well because the text could say "Click here!" while the link behind it could point to www.yahoo.com. So, when you copy "Click here", there is no way for Word to know how to format it as URL.
+3  A: 

This isn't possible. You have no control of how other applications (such as word/outlook) format.

When you paste something that looks like a URL into -- say -- Word, it recognizes it as a URL, and makes a link accordingly.

Therefore, there is no way for the web application to tell a user's desktop application to treat a string pasted from it in a given way.

Zack