JavaScript Clipboard Stuff / / No Comments Forgive the somewhat vague title, but I wanted to point folks to a series of articles I’ve had published on the Frontend Masters blog the past few weeks. I started writing for them recently, and while I note my "external writing" on my About page, I wanted to specifically call out this series. Over three articles, I discuss reading and writing to the clipboard with JavaScript as well as working with paste events: Reading from the Clipboard in JavaScript Writing to the Clipboard in JavaScript Handling Paste Events in JavaScript That last article is an updated version of a post of mine from July, but it’s got some new material in it so I definitely recommend checking it... more → Posted in: JavaScript Tagged with: Clipboard, JavaScript, Stuff
Detect the Content Type in the Clipboard / / No Comments A user’s clipboard is a “catch all” between the operating system and the apps employed on it. When you use a web browser, you can highlight text or right-click an image and select “Copy Image”. That made me think about how developers can detect what is in the clipboard. You can retrieve the contents of the user’s clipboard using the navigator.clipboard API. This API requires user permission as the clipboard could contain sensitive data. You can employ the following JavaScript to get permission to use the clipboard API: const result = await navigator.permissions.query({name: "clipboard-write"}); if (result.state === "granted" || result.state === "prompt") {... more → Posted in: JavaScript Tagged with: Clipboard, Content, Detect, type
Roll Your Own Copy to Clipboard Feature in 20 Lines of JavaScript – SitePoint / / No Comments Roll Your Own Copy to Clipboard Feature in 20 Lines of JavaScriptSitePointUsing the OS clipboard is a basic IT skill. As a developer, you've learned that tab, Ctrl/Cmd+A, Ctrl/Cmd+C followed by Ctrl/Cmd+V will highlight, copy and paste in an instant. Life is less easy for regular users. Even if a user knows what the … JavaScript – Google News… more → Posted in: JavaScript Tagged with: Clipboard, Copy, feature, JavaScript, Lines, Roll, SitePoint