Note: Advice in this article will only work for JxBrowser 6. See the corresponding article for JxBrowser 7 here.(注意:本文中的建议仅适用于JxBrowser6,JxBrowser7相应文章请点击这里。)

JxBrowser provides functionality that allows you to enable or disable various features, such as images, JavaScript, videos, etc., for each Browser instance. Use BrowserPreferences class to work with Browser features/preferences. To modify some features/preferences you must obtain BrowserPreferences instance using the Browser.getPreferences() method, modify preferences, and save them using the Browser.setPreferences() method.(JxBrowser提供的功能使您可以为每个浏览器实例启用或禁用各种功能,例如图像,JavaScript,视频等。使用BrowserPreferences类可使用浏览器功能/首选项。若要修改某些功能/首选项,必须使用Browser.getPreferences()方法获取BrowserPreferences实例,修改首选项后使用Browser.setPreferences()方法保存它们。)

The following sample demonstrates how to disable loading images and JavaScript execution on web page: (以下示例演示了如何在网页上禁用加载图像和禁用JavaScript:)

Browser browser = new Browser();

// Gets the current Browser's preferences
BrowserPreferences preferences = browser.getPreferences();

// Updates Browser's preferences

// Images and JavaScript will be disabled