Firefox copies images into clipboard in a weird format?
When I right-click on PNG or JPG image inside some webpage and select "Copy Image", I have a feeling that it gets stored in some "weird" format in my Windows clipboard. I say that because when I simply do Ctrl+V in Twitter or Slack, it should paste the image but it doesn't. I need to open something like Paint, paste there, then do Ctrl+C again and now pasting into Twitter or Slack in Firefox works. Really the only explanation I have is there's something funky about the clipboard storage format used by Firefox. Or what could it be?
所有回复 (5)
I'm waiting for a password reset on Twitter so I can't test at the moment...
Do you recall having this issue in Firefox 43 or 44? There have been some clipboard changes recently, with Firefox 44 removing legacy formats and Firefox 45 expected to undo that change. Somewhere in there, something might have happened regarding images.
I'm not quite sure, honestly. I think I've had this problem for a couple of months now but I may be wrong. BTW I am on Firefox 45.0b6.
You can use code like this in the Browser Console to check if a specific MIME type is on the clipboard.
- Services.clipboard.hasDataMatchingFlavors(["image/png"], 1, clipboard.kGlobalClipboard);
- Services.clipboard.hasDataMatchingFlavors(["image/jpg"], 1, clipboard.kGlobalClipboard);
See also:
A long time ago, in Firefox 12, Firefox starting including a HTML link on the clipboard when you Copy Image. This was to facilitate easy image embedding in Gmail messages.
When I paste into Twitter, nothing seems to happen, but if I rapidly repeat pressing Ctrl+v I can see the image occasionally added and removed, as though Twitter is receiving, rendering, and rejecting the HTML format. It kind of makes sense that Firefox is giving Twitter the HTML.
So far, no workarounds have come to mind...
@jscher2000 That is great info, thanks. I've installed this clipboard viewer and indeed, there's "HTML Format" entry with this contents:
Version:0.9 StartHTML:00000097 EndHTML:00000343 StartFragment:00000131 EndFragment:00000307 <html><body> <!--StartFragment--><img style="MARGIN-TOP: 0.5em; MARGIN-LEFT: 0.5em" alt="Windows Clipboard Viewer" src="http://www.freeclipboardviewer.com/images/windowsclipboard.png" height="372" width="450"><!--EndFragment--> </body> </html>
Then, there's a couple of image formats:
I agree that it does make sense to include the HTML into the copied data so maybe it's a paste problem? Like, in Twitter, paste is actually broken?
(However, I've just tried the same in Chrome and it behaves the same, i.e., paste doesn't work, and when I right-click and "Copy Image" in Chrome, it also stores a similar piece of HTML into the clipboard.)
This is really unpleasant from the user perspective - I have an image in my clipboard, the paste should just work.
由borekb于