API request: WebEngine settings
Peter Zhelezniakov
Peter.Zhelezniakov at oracle.com
Thu Apr 26 04:26:08 PDT 2012
We have several requests for customization of various aspects of WebEngine/WebView behavior:
http://javafx-jira.kenai.com/browse/RT-15684
http://javafx-jira.kenai.com/browse/RT-15008
The proposal is to add a new interface, javafx.scene.web.Settings. The Settings interface would control three preferences for now. Over time, more will likely be added:
- whether JavaScript execution is enabled in a WebEngine;
- whether context menus are enabled;
- location of a user CSS applied to pages loaded into a WebEngine.
An instance would be obtained from a new method: WebEngine.getSettings(). So a typical call would be
webEngine.getSettings().setJavaScriptEnabled(false);
Here is some javadoc:
------------------------------------------------------------------------
package javafx.scene.web;
/**
* Settings applied to a {@link WebEngine} object.
*
* @see WebEngine#getSettings()
*/
public interface Settings {
/**
* Returns whether JavaScript execution is enabled.
*/
public boolean isJavaScriptEnabled();
/**
* Enables or disables JavaScript execution.
*/
public void setJavaScriptEnabled(boolean enable);
/**
* Returns whether context menus are enabled.
*/
public boolean isContextMenuEnabled();
/**
* Enables or disables context menus.
*/
public void setContextMenuEnabled(boolean enable);
/**
* Returns location of the user stylesheet as a string URL.
*/
public String getUserStylesheetLocation();
/**
* Sets location of the user stylesheet.
* @param url stylesheet URL. This should be a local URL, i.e. either one
* of {@code 'data:'}, {@code 'file:'}, or {@code 'jar:'}. Remote URLs
* are not allowed for security reasons.
*/
public void setUserStylesheetLocation(String url);
}
class WebEngine {
/**
* Returns settings for this {@code WebEngine} object.
*/
public Settings getSettings();
}
--------------------------------------------------------------------------------
--
Peter
More information about the openjfx-dev
mailing list