I’m working on a Firefox plugin which contains a file holding some HTML data. How do I load in this file as a string?
I can do
var contents = Components.utils.import("resource://stuff.html");
but that then tries to execute the XML file as Javascript. I just want its contents!
For filesystem interactions in Firefox, use Mozilla XPCOM components. There are some wrappers for I/O XPCOM components such as JSLib and io.js
Using
io.jsit’d be something like: