Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 49547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:27:14+00:00 2026-05-10T16:27:14+00:00

I have a XULRunner application that needs to copy image data to the clipboard.

  • 0

I have a XULRunner application that needs to copy image data to the clipboard. I have figured out how to handle copying text to the clipboard, and I can paste PNG data from the clipboard. What I can’t figure out is how to get data from a data URL into the clipboard so that it can be pasted into other applications.

This is the code I use to copy text (well, XUL):

var transferObject=Components.classes['@mozilla.org/widget/transferable;1'].     createInstance(Components.interfaces.nsITransferable);  var stringWrapper=Components.classes['@mozilla.org/supports-string;1'].     createInstance(Components.interfaces.nsISupportsString);  var systemClipboard=Components.classes['@mozilla.org/widget/clipboard;1'].     createInstance(Components.interfaces.nsIClipboard);  var objToSerialize=aDOMNode;  transferObject.addDataFlavor('text/xul');  var xmls=new XMLSerializer(); var serializedObj=xmls.serializeToString(objToSerialize);  stringWrapper.data=serializedObj;  transferObject.setTransferData('text/xul',stringWrapper,serializedObj.length*2); 

And, as I said, the data I’m trying to transfer is a PNG as a data URL. So I’m looking for the equivalent to the above that will allow, e.g. Paint.NET to paste my app’s data.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:27:15+00:00Added an answer on May 10, 2026 at 4:27 pm

    Here’s a workaround that I ended up using that solves the problem pretty well. The variable dataURL is the image I was trying to get to the clipboard in the first place.

    var newImg=document.createElement('img'); newImg.src=dataURL;  document.popupNode=newImg;  var command='cmd_copyImageContents'  var controller=document.commandDispatcher.getControllerForCommand(command);  if(controller && controller.isCommandEnabled(command)){     controller.doCommand(command); } 

    That copies the image to the clipboard as an ‘image/jpg’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an xulrunner application that is running as a background html to pdf
Have an app that can use tts to read text messages. It can also
I have a xulrunner application that uses browser component to display HTML content. For
I have for the most part successfully embedded firefox/xulrunner into our c# application, but
Have a n-tire web application and search often times out after 30 secs. How
I have an Xulrunner app that loads fullscreen without any controls and loads a
I have a xulrunner application and I've been trying to reference remote content from
I would like to create an XPCOM plugin for a XULRunner application that I'm
One of the controls needed in my xulrunner application is an autocompleting text box
suppose, we have a Mozilla Prism like XULRunner app. There is a XUL window

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.