API request: WebEngine settings
Richard Bair
richard.bair at oracle.com
Thu Apr 26 07:53:17 PDT 2012
Hi Peter,
What is the benefit of having Settings vs adding properties to WebEngine? What would it look like from FXML?
Thanks
Richard
On Apr 26, 2012, at 4:26 AM, Peter Zhelezniakov <Peter.Zhelezniakov at oracle.com> wrote:
> 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