public final class JavaScriptSettings
extends java.lang.Object
Enabled - This setting determines if JavaScript is never enabled, always enabled, or if the user should be prompted
run javascript when a document containing javascript is opened. The JavaScriptSettings class contains 3 constants
that should be used for setting this field. (JavaScriptSettings.ALWAYS, JavaScriptSettings.PROMPT, and JavaScriptSettings.NEVER).
AllowPopups - This flag determines if JavaScript alerts will pop up in a message box or be printed to the console.
Note that since some alerts require user input, an Exception will be thrown if this flag is set to false when an alert
contains more than one option. Default is false.
SilenceErrors - This flag determines if errors will pop up in a message box or be ignored. Default is true, no errors will be shown.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALWAYS
Setting to always enable javascript.
|
static java.lang.String |
NEVER
Setting to ignore javascript and not run it.
|
static java.lang.String |
PROMPT
Setting to prompt the user (per document) to enable javascript.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getJSEnabled()
Get the setting for enabling javascript.
|
static boolean |
isAllowPopups()
Returns true if popups are allowed.
|
static boolean |
isSilenceErrors()
Returns true if errors will be silenced instead of displaying an alert.
|
static void |
setAllowPopups(boolean allowPopups)
Set to true to allow pop ups for alerts.
|
static void |
setJSEnabled(java.lang.String enabled)
Set the value that determines when javascript is executed.
|
static void |
setSilenceErrors(boolean silenceErrors)
Set to true to silence errors.
|
public static java.lang.String ALWAYS
public static java.lang.String PROMPT
public static java.lang.String NEVER
public static void setJSEnabled(java.lang.String enabled)
public static java.lang.String getJSEnabled()
public static boolean isAllowPopups()
public static void setAllowPopups(boolean allowPopups)
allowPopups
- Set to true to allow pop ups for alerts. Set to false to print alerts to standard out.public static boolean isSilenceErrors()
public static void setSilenceErrors(boolean silenceErrors)
silenceErrors
- Set to true to silence errors. Set to false to display errors in an alert.