javascript - how to get the base64 string of the clipboard data? -


i building xpcom component js. have got clipboard data in js, when data type image/png, want base64 string, code is:

        ......         trans.adddataflavor('image/png');         clipboard.getdata(trans, services.clipboard.kglobalclipboard);         trans.gettransferdata('image/png', str, strlength);         let mw = services.wm.getmostrecentwindow("navigator:browser");          data.data = str.value.queryinterface(ci.nsisupportscstring).data;         data.data = mw.btoa(data.data);         ... 

i can base64 string under linux, when run code in windows, got error: ns_nointerface: component returned failure code: 0x80004002 (ns_nointerface) [nsisupports.queryinterface]

data.data = str.value.queryinterface(ci.nsisupportscstring).data; not konw how base64 string of image data in xpcom component, can give me answer?

apparently images stored clipboard differently across platforms. check how jetpack reads them.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -