WebViewExtras2
ConsoleMessage
Fields:
- DEBUG As MessageLevel
- ERROR As MessageLevel
- LOG As MessageLevel
- TIP As MessageLevel
- WARNING As MessageLevel
Methods:
- IsInitialized As Boolean
- LineNumber As Int
- Message As String
- MessageLevel As MessageLevel
- SourceId As String
DefaultJavascriptInterface
Methods:
DefaultWebChromeClient
Events:
- ConsoleMessage (ConsoleMessage1 As ConsoleMessage))
- GeoLocationPermissionsRequest As Int
- PermissionRequest (PermissionRequest1 As PermissionRequest)
- PermissionRequestCanceled (PermissionRequest1 As PermissionRequest)
- ProgressChanged (NewProgress As Int)
Fields:
- GEOLOCATION_PERMISSION_ALLOW As Int
- GEOLOCATION_PERMISSION_ALLOW_AND_REMEMBER As Int
- GEOLOCATION_PERMISSION_DISALLOW As Int
- GEOLOCATION_PERMISSION_DISALLOW_AND_REMEMBER As Int
Methods:
- Initialize (EventName As String)
Initialize the DefaultWebChromeClient.
- IsInitialized As Boolean
DefaultWebViewClient
Events:
- LoadResource (Url As String)
- OverrideUrl (Url As String))
- PageFinished (Url As String)
- PageStarted (Url As String, FavIcon As Bitmap)
- ReceivedError (ErrorCode As Int, Description As String, FailingUrl As String)
- ReceivedLoginRequest ((Realm As String, Account As String, Args As String)
- ReceivedSslError (SslErrorHandler1 As SslErrorHandler, SslError1 As SslError)
- ScaleChanged (OldScale As Float, NewScale As Float)
- ShouldInterceptRequest (Url As String))
- UpdateVisitedHistory (Url As String, IsReload As Boolean)
- UserAndPasswordRequired (Host As String, Realm As String))
Fields:
- ERROR_AUTHENTICATION As Int
User authentication failed on server .
- ERROR_BAD_URL As Int
Malformed URL.
- ERROR_CONNECT As Int
Failed to connect to the server.
- ERROR_FAILED_SSL_HANDSHAKE As Int
Failed to perform SSL handshake.
- ERROR_FILE As Int
Generic file error.
- ERROR_FILE_NOT_FOUND As Int
File not found.
- ERROR_HOST_LOOKUP As Int
Server or proxy hostname lookup failed.
- ERROR_IO As Int
Failed to read or write to the server.
- ERROR_PROXY_AUTHENTICATION As Int
User authentication failed on proxy.
- ERROR_REDIRECT_LOOP As Int
Too many redirects.
- ERROR_TIMEOUT As Int
Connection timed out.
- ERROR_TOO_MANY_REQUESTS As Int
Too many requests during this load.
- ERROR_UNKNOWN As Int
Generic error.
- ERROR_UNSUPPORTED_AUTH_SCHEME As Int
Unsupported authentication scheme (not basic or digest).
- ERROR_UNSUPPORTED_SCHEME As Int
Unsupported URI scheme.
Methods:
- Initialize (EventName As String)
- IsInitialized As Boolean
FindListener
Events:
- FindResultReceived (ActiveMatchOrdinal As Int, NumberOfMatches As Int, IsDoneCounting As Boolean)
Methods:
- Initialize (EventName As String)
Initialize the FindListener.
- IsInitialized As Boolean
PermissionRequest
Fields:
- RESOURCE_AUDIO_CAPTURE As String
Resource belongs to audio capture device, like microphone.
- RESOURCE_PROTECTED_MEDIA_ID As String
Resource belongs to protected media identifier.
- RESOURCE_VIDEO_CAPTURE As String
Resource belongs to video capture device, like camera.
Methods:
- Deny
Call this method to deny the request.
- GetOrigin As String
Call this method to get the origin of the web page which is trying to access the restricted resources.
- GetResources As String[]
Call this method to get the resources the web page is trying to access.
- Grant (Resources() As String)
Call this method to grant origin the permission to access the given resources.
- IsInitialized As Boolean
SslError
Fields:
- SSL_DATE_INVALID As Int
The date of the certificate is invalid.
- SSL_EXPIRED As Int
The certificate has expired.
- SSL_IDMISMATCH As Int
Hostname mismatch.
- SSL_INVALID As Int
A generic error occurred.
- SSL_MAX_ERROR As Int
This constant was deprecated in API level 14.
This constant is not necessary for using the SslError API and can change from release to release.
- SSL_NOTYETVALID As Int
The certificate is not yet valid.
- SSL_UNTRUSTED As Int
The certificate authority is not trusted.
Methods:
- AddError (Error As Int) As Boolean
Adds the supplied SSL error to the set.
- GetCertificate As SslCertificate
Gets the SSL certificate associated with this object.
Note that B4A currently has no support for the SslCertificate object.
- GetPrimaryError As Int
Gets the most severe SSL error in this object's set of errors.
- GetUrl As String
Gets the URL associated with this object.
- HasError (Error As Int) As Boolean
Determines whether this object includes the supplied Error.
- IsInitialized As Boolean
SslErrorHandler
Methods:
- Cancel
Cancel this request and all pending requests for the WebView that had the error.
- IsInitialized As Boolean
- Proceed
Proceed with the SSL certificate.
WebBackForwardList
Methods:
- GetCurrentIndex As Int
Return the index of the current history item.
- GetCurrentItem As WebHistoryItem
Return the current history item.
- GetItemAtIndex (Index As Int) As WebHistoryItem
Return the history item at the given index.
- IsInitialized As Boolean
Properties:
- Size As Int [read only]
Returns the total size of the back/forward list.
WebHistoryItem
Methods:
Properties:
- Favicon As Bitmap [read only]
Return the favicon of this history item or Null if no favicon was found.
- OriginalUrl As String [read only]
Return the original url of this history item.
- Title As String [read only]
Return the document title of this history item.
- Url As String [read only]
Return the url of this history item.
The url is the base url of this history item.
WebResourceResponse
Methods:
- GetData As InputStreamWrapper
Gets the InputStream that provides the resource response's data.
- GetEncoding As String
Gets the resource response's encoding.
- GetMimeType As String
Gets the resource response's MIME type.
- Initialize (MimeType As String, Encoding As String, InputStream1 As InputStream)
- IsInitialized As Boolean
- SetData (InputStream1 As InputStream)
Sets the InputStream that provides the resource response's data.
- SetEncoding (Encoding As String)
Sets the resource response's encoding, for example UTF-8.
- SetMimeType (MimeType As String)
Sets the resource response's MIME type, for example text/html.
WebSettings
Fields:
- LOAD_CACHE_ELSE_NETWORK As Int
Use cached resources when they are available, even if they have expired.
- LOAD_CACHE_ONLY As Int
Don't use the network, load from the cache.
- LOAD_DEFAULT As Int
Default cache usage mode.
- LOAD_NORMAL As Int
This constant was deprecated in API level 17.
** This value is obsolete, as from API level HONEYCOMB and onwards it has the same effect as LOAD_DEFAULT. **
- LOAD_NO_CACHE As Int
Don't use the cache, load from the network.
Methods:
- EnableSmoothTransition
This method was deprecated in API level 17.
This method is now obsolete, and will become a no-op in future.
- GetAllowContentAccess As Boolean
Gets whether this WebView supports content URL access.
- GetAllowFileAccess As Boolean
Gets whether this WebView supports file access.
- GetBlockNetworkImage As Boolean
Gets whether the WebView does not load image resources from the network.
- GetBlockNetworkLoads As Boolean
Gets whether the WebView does not load any resources from the network.
- GetCacheMode As Int
Gets the current setting for overriding the cache mode.
- GetCursiveFontFamily As String
Get the cursive font family name. The default is "cursive".
Returns the cursive font family name as a string.
- GetDOMStorageEnabled As Boolean
Returns whether the DOM storage APIs are enabled.
- GetDatabaseEnabled As Boolean
Gets whether the database storage API is enabled.
- GetDatabasePath As String
Returns the location where the database storage API databases are saved.
- GetDefaultFixedFontSize As Int
Get the default fixed font size. The default is 16.
Returns a non-negative integer between 1 and 72.
- GetDefaultFontSize As Int
Get the default font size. The default is 16.
Returns a non-negative integer between 1 and 72.
- GetDefaultTextEncodingName As String
Get the default text encoding name. The default is "Latin-1".
Returns the default text encoding name as a string.
- GetDefaultUserAgent As String
Returns the default User-Agent used by a WebView.
- GetDefaultZoom As String
Get the default zoom density of the page.
Possible return values are: "CLOSE", "FAR" and "MEDIUM"
- GetDisplayZoomControls As Boolean
Returns true if the on screen zoom buttons are displayed.
Only supported on Android API level 11 and later.
- GetFantasyFontFamily As String
Gets the fantasy font family name.
- GetFixedFontFamily As String
Gets the fixed font family name.
- GetJavaScriptCanOpenWindowsAutomatically As Boolean
Get if javascript can open windows automatically. The default is false.
Returns true if javascript can open windows automatically during window.open().
- GetLightTouchEnabled As Boolean
Gets whether light touches are enabled.
- GetLoadWithOverviewMode As Boolean
Gets whether this WebView loads pages in overview mode.
- GetLoadsImagesAutomatically As Boolean
Gets whether the WebView loads image resources.
This includes images embedded using the data URI scheme.
- GetMediaPlaybackRequiresUserGesture As Boolean
Gets whether the WebView requires a user gesture to play media.
- GetMinimumFontSize As Int
Gets the minimum font size.
- GetMinimumLogicalFontSize As Int
Gets the minimum logical font size.
- GetPluginState As String
Get the current plugin state.
Possible return values are: "OFF", "ON" and "ON_DEMAND"
- GetSansSerifFontFamily As String
Gets the sans-serif font family name.
- GetSaveFormData As Boolean
Get whether the WebView is saving form data and displaying prior entries/autofill.
- GetSavePassword As Boolean
Get whether the WebView is saving passwords.
- GetSerifFontFamily As String
Gets the serif font family name.
- GetStandardFontFamily As String
Gets the standard font family name.
- GetTextSize As String
Returns a String SMALLEST, SMALLER, NORMAL, LARGER or LARGEST.
SMALLEST is 50%
SMALLER is 75%
NORMAL is 100%
LARGER is 150%
LARGEST is 200%
This method was deprecated in API level 14. Use GetTextZoom() instead.
- GetTextZoom As Int
Gets the text zoom of the page in percent.
- GetUseWideViewPort As Boolean
Gets whether the WebView is using a wide viewport.
- GetUserAgentString As String
Get the WebView's user-agent string.
- IsInitialized As Boolean
- SetAllowContentAccess (Allow As Boolean)
Enables or disables content URL access within WebView.
- SetAllowFileAccess (Allow As Boolean)
Enables or disables file access within WebView.
- SetAppCacheEnabled (Flag As Boolean)
Sets whether the Application Caches API should be enabled.
- SetAppCacheMaxSize (AppCacheMaxSize As Long)
Sets the maximum size for the Application Cache content.
- SetAppCachePath (AppCachePath As String)
Set a custom path to the Application Caches files.
The client must ensure it exists before this call.
appCachePath - String path to the directory containing Application Caches files. The appCache path can be the empty string but should not be null.
- SetBlockNetworkImage (Flag As Boolean)
Sets whether the WebView should not load image resources from the network (resources accessed via http and https URI schemes).
Note that this method has no effect unless GetLoadsImagesAutomatically() returns True.
Also note that disabling all network loads using SetBlockNetworkLoads(boolean) will also prevent network images from loading, even if this flag is set to False.
When the value of this setting is changed from true to false, network images resources referenced by content currently displayed by the WebView are fetched automatically.
The default value is False.
- SetBlockNetworkLoads (Flag As Boolean)
Sets whether the WebView should not load resources from the network.
- SetBuiltInZoomControls (Enabled As Boolean)
Sets whether the WebView should use its built-in zoom mechanisms.
- SetCacheMode (CacheMode As Int)
Override the way the cache is used. The way the cache is used is based on the navigation option.
For a normal page load, the cache is checked and content is re-validated as needed.
When navigating back, content is not revalidated, instead the content is just pulled from the cache.
This function allows the client to override this behavior.
cacheMode - Possible values are WebSettings constants: LOAD_CACHE_ELSE_NETWORK, LOAD_CACHE_ONLY, LOAD_DEFAULT, LOAD_NO_CACHE and LOAD_NORMAL.
- SetCursiveFontFamily (Font As String)
Set the cursive font family name.
Font - A font family name.
- SetDOMStorageEnabled (Enabled As Boolean)
Set whether the DOM storage API is enabled.
- SetDatabaseEnabled (Enabled As Boolean)
Set whether the database storage API is enabled.
- SetDatabasePath (path As String)
Sets the location where the database storage API databases are saved.
If path is an empty String "" then a default path will be set.
- SetDefaultFixedFontSize (Size As Int)
Set the default fixed font size.
Size - A non-negative integer between 1 and 72.
- SetDefaultFontSize (Size As Int)
Set the default font size.
Size - A non-negative integer between 1 and 72.
- SetDefaultTextEncodingName (Encoding As String)
Set the default text encoding name to use when decoding html pages.
The default is "Latin-1".
- SetDefaultZoom (Density As String)
Set the default zoom density of the page.
Density - Possible values are: "CLOSE", "FAR" and "MEDIUM".
- SetDisplayZoomControls (Enabled As Boolean)
Sets whether the on screen zoom buttons are displayed.
A combination of built in zoom controls enabled and on screen zoom controls disabled allows for pinch to zoom to work without the on screen controls.
Only supported on Android API level 11 and later.
- SetEnableSmoothTransition (Enable As Boolean)
This method was deprecated in API level 17.
This method is now obsolete, and will become a no-op in future.
- SetFantasyFontFamily (Font As String)
Sets the fantasy font family name.
- SetFixedFontFamily (Font As String)
Sets the fixed font family name.
- SetGeolocationDatabasePath (DatabasePath As String)
Sets the path where the Geolocation databases should be saved.
- SetGeolocationEnabled (Enabled As Boolean)
Sets whether Geolocation is enabled.
- SetJavaScriptCanOpenWindowsAutomatically (Flag As Boolean)
Tell javascript to open windows automatically.
This applies to the javascript function window.open().
- SetLightTouchEnabled (Enabled As Boolean)
Enables using light touches to make a selection and activate mouseovers.
- SetLoadWithOverviewMode (Overview As Boolean)
Sets whether the WebView loads pages in overview mode.
- SetLoadsImagesAutomatically (Flag As Boolean)
Sets whether the WebView should load image resources.
Note that this method controls loading of all images, including those embedded using the data URI scheme.
Use SetBlockNetworkImage(boolean) to control loading only of images specified using network URI schemes.
Note that if the value of this setting is changed from false to true, all images resources referenced by content currently displayed by the WebView are loaded automatically.
The default value is True.
- SetMediaPlaybackRequiresUserGesture (Requires As Boolean)
Sets whether the WebView requires a user gesture to play media.
- SetMinimumFontSize (Size As Int)
Set the minimum font size.
size - A non-negative integer between 1 and 72.
- SetMinimumLogicalFontSize (Size As Int)
Set the minimum logical font size.
size - A non-negative integer between 1 and 72.
- SetPluginState (State As String)
Tell the WebView to enable, disable, or have plugins load on demand.
On demand mode means that if a plugin exists that can handle the embedded content, a placeholder icon will be shown instead of the plugin.
When the placeholder is clicked, the plugin will be enabled.
Valid values are : "OFF", "ON" and "ON_DEMAND".
- SetRenderPriority (Priority As String)
Sets the priority of the Render thread.
- SetSansSerifFontFamily (Font As String)
Sets the sans-serif font family name.
- SetSaveFormData (Save As Boolean)
Store whether the WebView is saving form data.
- SetSavePassword (Save As Boolean)
Store whether the WebView is saving password.
- SetSerifFontFamily (Font As String)
Sets the serif font family name.
- SetStandardFontFamily (Font As String)
Sets the standard font family name.
- SetSupportMultipleWindows (Support As Boolean)
Sets whether the WebView whether supports multiple windows.
- SetSupportZoom (Support As Boolean)
Sets whether the WebView should support zooming using its on-screen zoom controls and gestures.
- SetTextSize (TextSize As String)
This method was deprecated in API level 14. Use SetTextZoom(int) instead.
TextSize - String value of SMALLEST, SMALLER, NORMAL, LARGER or LARGEST.
- SetTextZoom (TextZoom As Int)
Sets the text zoom of the page in percent.
- SetUseWideViewPort (Use As Boolean)
Tell the WebView to use a wide viewport.
- SetUserAgentString (UserAgent As String)
Set the WebView's user-agent string.
If the string UserAgent is null or empty, it will use the system default user-agent string.
- SupportMultipleWindows As Boolean
Gets whether the WebView supports multiple windows.
- SupportZoom As Boolean
Gets whether the WebView supports zoom.
WebViewDatabase
Methods:
- ClearFormData
Clears any saved data for web forms.
- ClearHttpAuthUsernamePassword
Clears any saved credentials for HTTP authentication.
- ClearUsernamePassword
Clears any saved username/password pairs for web forms.
- HasFormData As Boolean
Gets whether there is any saved data for web forms.
- HasHttpAuthUsernamePassword As Boolean
Gets whether there are any saved credentials for HTTP authentication.
- HasUsernamePassword As Boolean
Gets whether there are any saved username/password pairs for web forms.
- Initialize
- IsInitialized As Boolean
WebViewExtras
Methods:
- AddJavascriptInterface (JavascriptInterface As Object, InterfaceName As String)
Injects the supplied Java object into this WebView.
JavascriptInterface - The Java object to inject into this WebView's JavaScript context. Null values are ignored.
InterfaceName - The name used to expose the object in JavaScript.
- Back
- BringToFront
- CanGoBackOrForward (Steps As Int) As Boolean
Returns whether the WebView can go back or forward the given number of steps.
- CanGoback As Boolean
Returns whether the WebView has a back history item.
- CanZoomIn As Boolean
Returns whether the WebView can zoom in.
This method was deprecated in API level 17.
This method is prone to inaccuracy due to race conditions between the web rendering and UI threads; prefer onScaleChanged(WebView, float, float).
- CanZoomOut As Boolean
Returns whether the WebView can zoom out.
This method was deprecated in API level 17.
This method is prone to inaccuracy due to race conditions between the web rendering and UI threads; prefer onScaleChanged(WebView, float, float).
- CaptureBitmap As BitmapWrapper
- ClearCache (IncludeDiskFiles As Boolean)
Clear the WebView cache.
IncludeDiskFiles - If false, only the RAM cache is cleared.
Note that the cache is per-application, so this will clear the cache for all WebViews used in an application.
- ClearFormData
Removes the autocomplete popup from the currently focused form field, if present.
- ClearHistory
Tells this WebView to clear its internal back/forward list.
- ClearSslPreferences
Clears the SSL preferences table stored in response to proceeding with SSL certificate errors.
- CopyBackForwardList As WebBackForwardList
Gets the WebBackForwardList for this WebView.
- ExecuteJavascript (Javascript As String)
Executes a string of javascript statements.
- FindAll (Find As String) As Int
This method was deprecated in API level 16. findAllAsync(String) is preferred.
- FindAllAsynch (Find As String)
Finds all instances of 'Find' on the page and highlights them, asynchronously.
- FindNext (Forward As Boolean)
Highlights and scrolls to the next match found by findAllAsync(String), wrapping around page boundaries as necessary.
- FlingScroll (VelocityX As Int, VelocityY As Int)
Initiates a fling scroll.
VelocityX - Velocity of the scroll on the X axis.
VelocityY - Velocity of the scroll on the Y axis.
- Forward
- FreeMemory
Informs the WebView that memory is low so that it can free any available memory.
- GetContentHeight As Int
Gets the height of the HTML content.
- GetFavicon As Bitmap
Gets the favicon for the current page.
- GetHttpAuthUsernamePassword (Host As String, Realm As String) As String[]
Retrieves HTTP authentication credentials for the given Host and Realm.
- GetOriginalUrl As String
Gets the original URL for the current page.
- GetProgress As Int
Gets the progress for the current page.
- GetScale As Float
Get the WebView scale.
This method was deprecated in API level 17.
This method is prone to inaccuracy due to race conditions between the web rendering and UI threads; prefer onScaleChanged(WebView, float, float).
- GetSettings As WebSettings
- GetTitle As String
Gets the title for the current page.
- GoBackOrForward (Steps As Int)
Goes to the history item that is the number of steps away from the current item.
- Initialize (WebView1 As WebView)
- Invalidate
- Invalidate2 (arg0 As Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- InvokeZoomPicker
Invokes the graphical zoom picker widget for the WebView.
- IsInitialized As Boolean
- IsPrivateBrowsingEnabled As Boolean
Gets whether private browsing is enabled in the WebView.
- LoadHtml (arg0 As String)
- LoadUrl (arg0 As String)
- LoadUrl2 (Url As String, Headers As Map)
Loads the given URL with the specified additional HTTP headers.
- OverlayHorizontalScrollbar As Boolean
Gets whether horizontal scrollbar has overlay style.
- OverlayVerticalScrollbar As Boolean
Gets whether vertical scrollbar has overlay style.
- PageDown (ScrollToBottom As Boolean) As Boolean
Scroll the contents of the WebView down by half the page size.
ScrollToBottom - If True then the WebView will be scrolled to the bottom of the page.
Returns a Boolean value to indicate the success or failure of the scroll.
- PageUp (ScrollToTop As Boolean) As Boolean
Scroll the contents of the WebView up by half the page size.
ScrollToTop - If True then the WebView will be scrolled to the top of the page.
Returns a Boolean value to indicate the success or failure of the scroll.
- PauseTimers
Pauses all layout, parsing, and JavaScript timers for all WebViews.
- PostUrl (Url As String, PostData() As Byte)
Loads the URL with postData using "POST" method into this WebView.
- Reload
Reloads the current URL.
- RemoveJavascriptInterface (InterfaceName As String)
Removes a previously injected Java object from this WebView.
- RemoveView
- RequestFocus As Boolean
- ResumeTimers
Resumes all layout, parsing, and JavaScript timers for all WebViews.
- SavePassword (Host As String, Username As String, Password As String)
Sets a Username and Password pair for the specified Host.
- SaveWebArchive (Filename As String)
Saves the current view as a web archive.
- SendToBack
- SetBackgroundImage (arg0 As Bitmap)
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetFindListener (FindListener1 As FindListener)
Registers FindListener1 to be notified as find-on-page operations progress.
- SetHorizontalScrollbarOverlay (Overlay As Boolean)
Specifies whether the horizontal scrollbar has overlay style.
- SetHttpAuthUsernamePassword (Host As String, Realm As String, Username As String, Password As String)
Stores HTTP authentication credentials for a given Host and Realm.
- SetInitialScale (ScaleInPercent As Int)
Sets the initial scale for this WebView.
- SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetNetworkAvailable (NetworkUp As Boolean)
Informs WebView of the network state.
- SetOverScrollMode (Mode As Int)
Set the over-scroll mode for this WebView.
- SetScrollBarStyle (Style As Int)
Specify the style of the scrollbars.
- SetVerticalScrollbarOverlay (Overlay As Boolean)
Specifies whether the vertical scrollbar has overlay style.
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- SetWebChromeClient (WebChromeClient1 As WebChromeClient)
- SetWebViewClient (WebViewClient1 As WebViewClient)
- ShowFindDialog (Text As String, ShowIme As Boolean) As Boolean
Starts an ActionMode for finding text in this WebView.
- StopLoading
- Zoom (arg0 As Boolean) As Boolean
Properties:
- Background As Drawable
- Color As Int [write only]
- Enabled As Boolean
- Height As Int
- JavaScriptEnabled As Boolean
- Left As Int
- Tag As Object
- Top As Int
- Url As String [read only]
- Visible As Boolean
- Width As Int
- ZoomEnabled As Boolean