The comment has rightly pointed out to a way that one could programatically set the preferences of SWT Browser widget. The way it could be done is shown in the following code snippet.
Browser browser = MozBrowserUtil.openMozillaBrowser("about:blank");
nsIServiceManager servMgr = Mozilla.getInstance().getServiceManager();
nsIPrefBranch prefs = ( nsIPrefBranch )servMgr.
getServiceByContractID("@mozilla.org/preferences-service;1",
nsIPrefBranch.NS_IPREFBRANCH_IID);
prefs.setIntPref("network.proxy.type", 1);
prefs.setCharPref("network.proxy.http", host);
prefs.setIntPref("network.proxy.http_port", port);
browser.setUrl(url);
Again, I thank the anonymous commentor for bringing this to my notice. I appreciate all your comments and would be better if you leave me atleast an email or a URL to your page/blog so that I can get back to you.
No comments:
Post a Comment