开发者

how can I block the browser xul component from downloading?

开发者 https://www.devze.com 2023-01-17 16:45 出处:网络
I have a xulrunner app, and I am using the browser object; I would like to call loadURI to download a URL and not have it load any of the content on the page.

I have a xulrunner app, and I am using the browser object; I would like to call loadURI to download a URL and not have it load any of the content on the page.

Is there a way to specify via pref a way to disable downloading of resources such as CSS, images, JavaScript?

Update I found the nsIDocShell documentation, and this solves half of my problem; is there a way to prevent it from download javascript and CSS files?

browser.docShell.allowImages = false;
browser.docShell.allowMetaRedirects = false;
browser.docShell.allo开发者_运维问答wAuth = false;
browser.docShell.allowPlugins = false;
browser.docShell.allowSubframes = false;


See How to stop firefox from downloading and applying CSS via a firefox extension?. It doesn't have an easy answer also, but the questioner does suggest a workaround that might be close enough to your needs.

0

精彩评论

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

关注公众号