Skip to content

LinkyMH/WebClippy

Repository files navigation

WebClippy - Clipboard for Clickteam Fusion 2.5 (HTML5)

* For installation, check Releases

A lightweight, secure clipboard extension for the Clickteam Fusion 2.5 HTML5 runtime. WebClippy provides async read/write access to plain text, paste event capture, success/failure conditions, and full compliance with modern browser security restrictions (e.g., user gestures, secure contexts).

  • Runtime: HTML5 (Browser)
  • Focus:
    • Clipboard read/write
    • Paste event capture
    • Async flow (Just like the Clipboard API)
    • Error handling and diagnostics

Why WebClippy?

Modern browsers restrict clipboard access for security and privacy. WebClippy wraps best practices and the Clipboard API behind Fusion-friendly Actions, Conditions, Expressions, and Properties (ACEPs), so you can:

  • Write text to the clipboard on user actions (e.g., button clicks)
  • Read text from the clipboard asynchronously
  • Capture real paste events
  • React to success/failure with clear events and error info
  • Respect browser constraints (user gesture, HTTPS, permissions)

Features

  • Secure, standards-based clipboard access (Navigator Clipboard API)
  • Async request handling with success and error callbacks
  • Paste event capture (including Ctrl/Cmd+V)
  • Availability checks and helpful diagnostics
  • As it is an extension, no coding required-just use ACE in your event editor. (No more calling JavaScript from the HTML5 Object!)
  • Benefit from all the free advantages of a Fusion Object (e.g., easy reuse, OOP, Object Selection, etc.)

Common Event Patterns

  1. Click-to-Copy

    * Button CopyText clicked
    	WebClippy : Write Text "Write Test from an HTML5 Fusion App!"
    
    * WebClippy : On Write Success
    	DebugLog : Add line "WebClippy.On Write Success!"
    
    * WebClippy : On Write Failed
    	DebugLog : Add line "WebClippy.On Write Failed: Error: " + LastError$( "WebClippy" ) + ", Code: " + Str$(LastErrorCode( "WebClippy" )) + ", Mess: " + LastErrorMessage$( "WebClippy" )
    
  2. Paste Capture

    * Start of Frame
    	WebClippy : Enable Paste Capture (Element ID: "", Capture on Doc: 1)
    
    * WebClippy : On Paste
    	DebugLog : Add line "WebClippy.Paste Event: Pasted Text: " + PasteText$( "WebClippy" )
    
  3. Read on User Gesture

    * Button ReadClipboardText clicked
    	WebClippy : Read Text
    
    * WebClippy : On Read Success
    	Username : Set text ClipboardText$( "WebClippy" )
    	DebugLog : Add line "WebClippy.On Read Success! Clipboard Text: " + ClipboardText$( "WebClippy" )
    
    * WebClippy : On Read Failed
    	DebugLog : Add line "WebClippy.On Read Failed: Error: " + LastError$( "WebClippy" ) + ", Code: " + Str$(LastErrorCode( "WebClippy" )) + ", Mess: " + LastErrorMessage$( "WebClippy" )
    

Browser and Platform Notes

  • Secure context required (Most browsers require HTTPS for clipboard access).

  • User activation required

    • Write operations should generally be initiated from a user gesture (e.g., click).
    • Reads may also require a gesture or explicit permission depending on the browser.
  • Paste capture: The "On Paste" event is the most reliable way to accept user-pasted text with the least friction. (Note that while similar to Clipboard read, it's not the same! It also does not require the same permissions or user gesture constraints.)

  • Compatibility: Designed for modern browsers with the Clipboard API:

    • Chrome/Edge/Opera: Good support
    • Firefox: Clipboard read/write support improves over time; paste event capture recommended
    • Safari/iOS: Stricter; rely on user gestures and paste capture where possible

For more on the Clipboard API, see MDN:


Troubleshooting

  • "Nothing happens on write"

    • Ensure the action is invoked from a user gesture (button click, key press in the canvas, touch, etc).
    • Confirm you're serving over HTTPS.
    • If you don't want to rely on user gestures, uncheck "Require User Gesture" in properties (not recommended). This may still fail in some browsers, and requires the Clipboard Permission.
    • Always make sure to handle the "On Write Success/Failed" events to catch any errors (LastError$, LastErrorMessage$, LastErrorCode).
  • "Read fails or is denied"

    • Some browsers require explicit permission or a user gesture for read.
    • Always handle "On Read Success/Failed" events to diagnose issues.
  • "Paste works, but read/write doesn't"

    • Paste capture does not require the same Clipboard API permission path; it leverages the user's actual paste action (A Ctrl/Cmd+V or context menu, etc.)
    • Make sure to always error handle and log properly on read/write operations. As well checking the Clipboard API availability with the "Is API Supported?" Condition, and querying the permissions of Write/Read.
  • "Works locally, fails in production"

    • Check HTTPS and content security policy (CSP).
    • Verify the site is not in an iframe without appropriate permissions.

Development

  • Based on the DarkEdif SDK:
  • JavaScript runtime (clipboard logic, event wiring)
  • C++/C components for extension scaffolding (edittime/runtime glue)

Contributions are welcome. If you're unsure where to start, open an Issue to discuss changes. If you are sure of a fix or feature, submit a pull request with the changes. But it would be much appreciated if you contact me on Discord first.


Support

When reporting a problem, please include:

  • Browser and OS versions
  • Whether you're on HTTPS
  • If Clipboard Permission is enabled
  • A minimal reproduction (Events screenshot or MFA)
  • The LastError$ and LastErrorMessage$ text retrieved from Events like On Read/Write Failed (if any)

About

HTML5 clipboard extension for Clickteam Fusion 2.5, providing secure read/write access to plain text data with async request handling, paste event capture, success/failure conditions, and full compliance with browser security restrictions.

Resources

License

Stars

Watchers

Forks

Contributors