Copy HyperLink Using JavaScript

I have a webpage that contains a list of hyperlinks to pdf documents.  The users of the page copy the links into email instead of attaching the files directly to the email.  The links when in the email need to be just the link text with the url hidden.  If the user highlights the link from the list and manually copies and pastes the link into say gmail the link appears with just the text and functions properly.  The problem comes in when I try to use JavaScript to do the copy of the hyperlink.  The function I am using copies the <a href='url'>Link Text</a> html markup to the clipboard but when pasted the link shows as html "<a href='url'>Link Text</a>" and not just the link text with a functional link as when you do the copy manually.  

I'm try to determine the difference.  Not sure what manually hightlighting the link copying and pasting does that is different than copying and pasting the html link.  Please advise the correct way to do this.

Any input would be greatly appreciated.

Thanks...
myevh3Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

StealthyDevCommented:
Do you want only for IE?
0
StealthyDevCommented:
Hi dear, after investigation, i have found that you can copy only TEXT to clipboard using JavaScript.

If you do edit-copy (or ctrl+c) it can copy OBJECTS.

More on this:

http://plugins.jquery.com/project/clipboard
http://www.jeffothy.com/weblog/clipboard-copy/
http://msdn.microsoft.com/en-us/library/ms535220%28VS.85%29.aspx

Best Regards.
0
myevh3Author Commented:
The solution is only for IE.
0
StealthyDevCommented:
Yes, I understand myevh, but as i told already, you cannot use clipboard copy using any of the browser for security reasons.

You can copy only text to clipboard. (where as a "link" is an object).

Hope you got it?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
myevh3Author Commented:
Based on the comments there is no solution possible.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.