[Mozile] Paste Bin
James A. Overton
james at overton.ca
Thu Sep 14 10:36:17 EDT 2006
Here are the results of a few experiments with iframes in Firefox 1.5.
You can create an iframe with designMode on. The user can paste text
or HTML into the iframe, and the parent document can grab it using
something like iframe.contentDocument.body.innerHTML. So Reto's idea
for a "paste bin" will work nicely using an iframe.
However, unprivileged scripts aren't allowed to call execCommand
("paste"). YOu'll just get an NS_ERROR_DOM_XPCONNECT_ACCESS_DENIED
error. So you can't have a script in the parent document paste into
the iframe and extract the contents automatically. That would
completely circumvent the security measures placed on the clipboard,
and that potential security hole is closed. See this page for
details: http://www.mozilla.org/editor/midasdemo/securityprefs.html
The best solution for Mozilla will be an extension which allows
limited access to the clipboard. This was working in Mozile 0.7, and
eventually we'll implement it for Mozile 0.8. (The extension would
also control the editing caret automatically.) The advantage of the
paste bin solution, of course, is that it doesn't require the user to
install an extension.
James
More information about the Mozile
mailing list