views:

250

answers:

0

I need to render user submitted html within an xul:panel. I'm inserting the html into an xul:browser element within the panel so that invalid xhtml is not an issue (it's sandboxed within the browser frame).

Is there anyway to disable javascript within the xul:browser? My original plan was to write some regex that strips out all JS from the html, but it would be so much easier if I could simply disable JS and not worry about it.

EDIT: Well, browser.docShell.allowJavascript = false; is what I was looking for. Unfortunately this only works if the browser type is set to "content", and if I set a type to "content" xul:browser doesn't render correctly within a panel (known firefox bug that has been around for years). Without a content type it gives the loaded page access to CHROME, which is the reason I wanted to disable JS in the first place.. ugh