开发者

Possible to disable javascript within a xul:browser element (firefox extension)?

开发者 https://www.devze.com 2022-12-08 13:35 出处:网络
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

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. Unfor开发者_JAVA技巧tunately 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

0

精彩评论

暂无评论...
验证码 换一张
取 消