Link to home
Start Free TrialLog in
Avatar of fox_statton
fox_statton

asked on

Copy URL to clipboard using JS

Hi all,
Is there anyway I could create a link that would copy the current pages URL to the clipboard (ready to be pasted) when a user clicks on it?

Avatar of alkisg
alkisg
Flag of Greece image

Use the standard clipboard-copying techniques,
http://www.htmlgoodies.com/beyond/javascript/article.php/3458851
https://www.experts-exchange.com/questions/20233392/Copy-to-clipboard.html

and for the current URL, put location.href to a hidden text box and select it before copying.
ASKER CERTIFIED SOLUTION
Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

Sorry the option is not in the advanced options tab, it is in the custom security option screen in IE. By default it is on although a while ago it was considered a potential security hole and many security policies will have it disabled or set to prompt the user.

Regards,

Lee