简体   繁体   中英

Copying links on mobile phones

I am trying to create a button on a mobile website that when the button is clicked, a link (eg example.com) is copied to the user's clipboard.

The user can then paste this link in an email or a text message or into his browser.

Thanks!

Direct copying to the clipboard is not permitted by modern browsers for security reasons. What you can do is to let the browser select a piece of text for the user to select and copy.

An example that uses this method is Google's URL shortener

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM