There is, I use the following code to set HTML from my application:
void SetHTML(GeckoString aHTMLString)
{
nsresult rv;
nsCOMPtr<nsIIOService> theIOService =
do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
nsCOMPtr<nsIWebBrowserStream> theWebBrowserStream =
do_QueryInterface(iWebBrowser);
nsEmbedCString theSpec("about:blank");
nsCOMPtr<nsIURI> theBaseURI;
nsCOMPtr<nsIURI> theURI;
theIOService->NewURI(theSpec, "", theBaseURI, getter_AddRefs(theURI));
nsIURI *t = theURI;
nsEmbedCString theContentType("text/html");
// Seems like there is no direct UTF-16 support for the AppendToStream
method, so convert.
nsEmbedString theUniContent((PRUnichar*)aHTMLString.c_str());
nsEmbedCString theContent;
NS_UTF16ToCString(theUniContent, NS_CSTRING_ENCODING_UTF8,
theContent);
if(theWebBrowserStream) {
theWebBrowserStream->OpenStream(theURI, theContentType);
theWebBrowserStream->AppendToStream((PRUint8*)theContent.get(),
strlen(theContent.get()));
theWebBrowserStream->CloseStream();
}
}
GeckoString is a typedef for a std::string. Using the OpenStream you
should be able to accomplish what you want.
Olivier Danes wrote:
> Hi all,
>
> Is it possible for gecko to retrieve document content from a memory
> buffer (maybe using inputstream) instead of using network ?
>
> I'm able to give server response header if needed.
>
> thx Olivier
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding