Jump to content

copy to clipboard


Ocean West

Recommended Posts

Posted

Playing round with the new content databases - and was wondering if it is possible to include some code to generate a "copy button" which would appear next to a field when others are reading the display template of the record - so they can easily copy the content to their clipboard.

this is code

[ copy to clipboard]

Posted

I've spent a bit of time researching this and trying to find potential solutions for my own applications. As far as I am aware, it is not possible to copy data to the users clipboard using Javascript.

It's mostly a security concern. I believe there was once a bug that allowed you to abuse some HTML 5 API and accomplish this, but it has long since been fixed.

I don't think there's any other way to do this. You can select text for the user, but you can't copy text to the clipboard for them.

tl;dr No.

Posted

Oh right I'm sorry. Yeah, I believe you can accomplish it using flash plugins like Zeroclipboard.

I was explicitly searching for ways to do it without needing flash but I never found anything. I did come across the Clipboard API you are referencing, I actually found it from that very same SO post, but it doesn't seem to work in any browser I've tested currently.

A bit dissapointing, but maybe it will be an option in the not so distant future. At the very least it could be implemented as something similar to other browser API's like GeoLocation and desktop notifications, where it prompts the user for permission before granting the website access to the clipboard. 

Posted

Thanks for the info. Perhaps there will be more renewed interest for this after release and every one has had months on the new platform. ( now that IPC is much more easier to understand then 3x version people may venture in to come custom creation needing the same feature.

Posted

It's nothing specific to IP.Board, it's just currently impossible to do with Javascript in general.

You could still integrate a flash plugin like Zeroclipboard yourself if you really wanted.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...