CustomWebView : An extended form of Web Viewer

Download latest version here

1.Introduction

It is an extended version of web viewer with more customization and flexibility. Its customization and additional features make it different and much more better than Web Viewer from the perspective of App Developer as well as User.
Note: CustomWebView can work only on devices running on at least Android 5.0

Latest Version : 12
Required Api : 21
Released: 2020-05-12T18:30:00Z
Last Updated: 2023-03-08T18:30:00Z

2.Features

  • More customization options than normal web viewer
  • Long Click event
  • New window request event
  • Close window request event
  • Load local files and content using Html and Js
  • Find words and phrases in webview
  • Evaluate Js and get result
  • Upload files to websites
  • Error occurred event
  • Get output from console
  • Form Resubmission event
  • Get content height
  • Get SSL Certificate of website
  • Get/Set cookies for particular url
  • Event for permission(s) request and grant permission(s) manually
  • Print web content
  • A wide range of tools for working with JavaScript
  • Accepts external links/Adds your app in browsers list when you use BrowserPromptHelper extension
  • Download files using built-in download helper extension DownloadHelper
  • Scroll Changed event and function to scroll to particular position
  • Create and Remove webviews dynamically
  • Ad blocker
  • Full screen video feature (OnShowCustomView and OnHideCustomView)
  • Pause and Resume webview
  • Get internal history
  • Create webpage shortcuts
  • Download offline pages and load them without internet connection

3.Designer Properties

4.Blocks

5.Documentation

Events

AfterArchiveSavedEvent raised after 'SaveArchive' method.If 'success' is true then returns file path else empty string.
success | boolean
filePath | text
AfterJavaScriptEvaluatedEvent raised after evaluating Js and returns result.
result | text
CookiesRemovedEvent raised after 'ClearCokies' method with result
successful | boolean
FileUploadNeededEvent raised when file uploading is needed
id | number
mimeType | text
isCaptureEnabled | boolean
FindResultReceivedEvent raised after 'Find' method with int 'activeMatchOrdinal','numberOfMatches' and 'isDoneCounting'
id | number
activeMatchOrdinal | number
numberOfMatches | number
isDoneCounting | boolean
GotCertificateEvent raised after getting SSL certificate of current displayed url/website with boolean 'isSecure' and Strings 'issuedBy','issuedTo' and 'validTill'.If 'isSecure' is false and other values are empty then assume that website is not secure
isSecure | boolean
issuedBy | text
issuedTo | text
validTill | text
GotPrintResultEvent raised after getting previus print's result.
printId | text
isCompleted | boolean
isFailed | boolean
isBlocked | boolean
LongClickedEvent raised when something is long clicked in webview with item(image,string,empty,etc) and type(item type like 0,1,8,etc)
id | number
item | text
secondaryUrl | text
type | number
OnCloseWindowRequestEvent triggered when a window needs to be closed
id | number
OnConsoleMessageEvent raised after getting console message.
message | text
lineNumber | number
sourceID | number
level | text
OnDownloadNeededEvent raised when downloading is needed.
id | number
url | text
contentDisposition | text
mimeType | text
size | number
OnErrorReceivedEvent raised when any error is received during loading url and returns message,error code and failing url
id | number
message | text
errorCode | number
url | text
OnFormResubmissionEvent raised when resubmission of form is needed
id | number
OnGeolocationRequestedEvent raised when page asks for location access. Developer must handle/show dialog from him/herself.
origin | text
OnHideCustomViewEvent raised when current page exits from full screen mode
OnJsAlertEvent raised when Js have to show an alert to user
id | number
url | text
message | text
OnJsConfirmTells to display a confirm dialog to the user.
id | number
url | text
message | text
OnJsPromptEvent raised when JavaScript needs input from user
id | number
url | text
message | text
defaultValue | text
OnNewWindowRequestEvent raised when new window is requested by webview with boolean 'isDialog' and 'isPopup'
id | number
isDialog | boolean
isPopup | boolean
OnPermissionRequestEvent raised when a website asks for specific permission(s) in list format.
permissionsList | list
OnProgressChangedEvent raised when page loading progress has changed.
id | number
progress | number
OnReceivedHttpAuthRequestNotifies that the WebView received an HTTP authentication request.
id | number
host | text
realm | text
OnReceivedSslErrorEvent for OnReceivedSslError
errorCode | number
OnScrollChangedEvent raised when webview gets scrolled
id | number
scrollX | number
scrollY | number
oldScrollX | number
oldScrollY | number
canGoLeft | boolean
canGoRight | boolean
OnShowCustomViewEvent raised when current page enters in full screen mode
PageLoadedEvent raised when page loading has finished.
id | number
PageStartedEvent indicating that page loading has started in web view.
id | number
url | text
SwipedEvent raised when webview is swiped
id | number
direction | number
WebViewStringChangedWhen the JavaScript calls AppInventor.setWebViewString this event is run.
value | text

Methods

AllowGeolocationAccessMethod for AllowGeolocationAccess
allow | boolean
remember | boolean
CanGoBackGets whether this WebView has a back history item
CanGoBackOrForwardGets whether the page can go back or forward the given number of steps.
steps | number
CanGoForwardGets whether this WebView has a forward history item.
CancelPrintingCancels current print job. You can request cancellation of a queued, started, blocked, or failed print job.
ClearCacheClears the resource cache.
ClearCookiesRemoves all cookies and raises 'CookiesRemoved' event
ClearFormDataClears the form data of the webview
Added by Xoma
id | number
ClearInternalHistoryTells this WebView to clear its internal back/forward list.
ClearLocationClear all location preferences.
ClearMatchesClears the highlighting surrounding text matches.
ConfirmJsWhether to proceed JavaScript originated request
confirm | boolean
ContentHeightGets height of HTML content
ContinueJsInputs a confirmation response to Js
input | text
CreateShortcutCreates a shortcut of given website on home screen
url | text
iconPath | text
title | text
CreateWebViewCreates the webview in given arrangement with id
container | component
id | number
CurrentIdReturns current id
DismissJsAlertDismiss previously requested Js alert
EvaluateJavaScriptAsynchronously evaluates JavaScript in the context of the currently displayed page.
script | text
FindFinds all instances of find on the page and highlights them, asynchronously. Successive calls to this will cancel any pending searches.
string | text
FindNextHighlights and scrolls to the next match if 'forward' is true else scrolls to previous match.
forward | boolean
GetCookiesGet cookies for specific url
url | text
GetIdsReturns a list of used ids
GetInternalHistoryGet internal history of given webview.
id | number
GetProgressGets the progress for the given webview
id | number
GetScrollXReturn the scrolled left position of the webview
GetScrollYReturn the scrolled top position of the webview
GetSslCertificateGets the SSL certificate for the main top-level page and raises 'GotCertificate' event
GetWebViewReturns webview object from id
id | number
GoBackGoes back in the history of this WebView.
GoBackOrForwardGoes to the history item that is the number of steps away from the current item. Steps is negative if backward and positive if forward.
steps | number
GoForwardGoes forward in the history of this WebView.
GoToUrlLoads the given URL.
url | text
GrantPermissionGrants given permissions to webview.Use empty list to deny the request.
permissions | text
HideCustomViewHides previously shown custom view
InvokeZoomPickerInvokes the graphical zoom picker widget for this WebView. This will result in the zoom widget appearing on the screen to control the zoom level of this WebView.Note that it does not checks whether zoom is enabled or not.
LoadHtmlLoads the given data into this WebView using a 'data' scheme URL.
html | text
LoadInNewWindowLoads requested url in given webview
id | number
LoadWithHeadersLoads the given URL with the specified additional HTTP headers defined is list of lists.
url | text
headers | dictionary
PageDownScrolls the contents of the WebView down by half the page size
bottom | boolean
PageUpScrolls the contents of the WebView up by half the page size
top | boolean
PauseWebViewDoes a best-effort attempt to pause any processing that can be paused safely, such as animations and geolocation. Note that this call does not pause JavaScript.
id | number
PostDataLoads the URL with postData using 'POST' method into active WebView.
url | text
data | text
PrintWebContentPrints the content of webview with given document name
documentName | text
ProceedHttpAuthRequestInstructs the WebView to proceed with the authentication with the given credentials.If both parameters are empty then it will cancel the request.
username | text
password | text
ProceedSslErrorMethod for ProceedSslError
proceed | boolean
RegisterDeepLinkRegisters to open specified link in associated external app(s)
scheme | text
ReloadReloads the current URL.
RemoveWebViewDestroys the webview and removes it completely from view system
id | number
RestartPrintingRestarts current/previous print job. You can request restart of a failed print job.
ResubmitFormWhether to resubmit form or not.
reSubmit | boolean
ResumeWebViewResumes the previously paused WebView.
id | number
SaveArchiveSaves the current site as a web archive
dir | text
ScrollToScrolls the webview to given position
x | number
y | number
SetCookiesSets cookies for given url
url | text
cookieString | text
SetVisibilitySets the visibility of webview by id
id | number
visibility | boolean
SetWebViewSet specific webview to current webview by id
id | number
StopLoadingStops the current load.
UploadFileUploads the given file from content uri.Use empty string to cancel the upload request.
contentUri | text
ZoomByPerforms a zoom operation in the WebView by given zoom percent
zoomP | number
ZoomInPerforms zoom in in the WebView
ZoomOutPerforms zoom out in the WebView

Properties

AdHostsSets the ad hosts which will be blocked
Property Type : write-only
Accepts : text
AutoLoadImagesSets whether the WebView should load image resources
Property Type : read-write
Accepts : boolean
AutoplayMediaSets whether the WebView requires a user gesture to play media
Property Type : read-write
Accepts : boolean
BackgroundColorSets background color of webview
Property Type : write-only
Accepts : number
BlockAdsSets whether to block ads or not
Property Type : write-only
Accepts : boolean
BlockNetworkLoadsSets whether the WebView should not load resources from the network.Use this to save data.
Property Type : read-write
Accepts : boolean
CacheModeSets cache mode for active webview
Property Type : read-write
Accepts : number
CurrentPageTitleTitle of the page currently viewed
Property Type : read-only
Accepts : text
CurrentUrlURL of the page currently viewed
Property Type : read-only
Accepts : text
DeepLinksSets whether to enable deep links or not i.e. tel: , whatsapp: , sms: , etc.
Property Type : read-write
Accepts : boolean
DesktopModeSets whether to load content in desktop mode
Property Type : read-write
Accepts : boolean
DisplayZoomSets whether the WebView should display on-screen zoom controls
Property Type : read-write
Accepts : boolean
EnableJSTells the WebView to enable JavaScript execution.
Property Type : read-write
Accepts : boolean
FileAccessSets whether webview can access local files.Use this to enable file uploading and loading files using HTML
Property Type : read-write
Accepts : boolean
FollowLinksDetermines whether to follow links when they are tapped in the WebViewer.If you follow links, you can use GoBack and GoForward to navigate the browser history
Property Type : read-write
Accepts : boolean
FontSizeSets the default font size of text. The default is 16.
Property Type : read-write
Accepts : number
InitialScaleSets the initial scale for active WebView. 0 means default. If initial scale is greater than 0, WebView starts with this value as initial scale.
Property Type : write-only
Accepts : number
LayerTypeSets layer type
Property Type : read-write
Accepts : number
LoadWithOverviewModeSets whether the WebView loads pages in overview mode, that is, zooms out the content to fit on screen by width. This setting is taken into account when the content width is greater than the width of the WebView control.
Property Type : read-write
Accepts : boolean
LongClickableSets whether to enable text selection and context menu
Property Type : read-write
Accepts : boolean
OverScrollModeSets over scroll mode
Property Type : read-write
Accepts : number
PromptForPermissionReturns whether webview will prompt for permission and raise 'OnPermissionRequest' event or not
Property Type : read-write
Accepts : boolean
RotationAngleSets rotation angle
Property Type : read-write
Accepts : number
ScrollBarWhether to display horizonatal and vertical scrollbars or not
Property Type : write-only
Accepts : boolean
ScrollBarStyleSets scroll bar style
Property Type : read-write
Accepts : number
ScrollableProperty for Scrollable
Property Type : write-only
Accepts : boolean
SupportMultipleWindowsSets whether the WebView supports multiple windows
Property Type : read-write
Accepts : boolean
UseWideViewPortSets whether the WebView should enable support for the 'viewport' HTML meta tag or should use a wide viewport.
Property Type : read-write
Accepts : boolean
UserAgentGet webview user agent
Property Type : read-write
Accepts : text
UsesLocationWhether or not to give the application permission to use the Javascript geolocation API
Property Type : write-only
Accepts : boolean
VibrationEnabledSets whether vibration feedback enabled on long click
Property Type : read-write
Accepts : boolean
VisibleReturns the visibility of current webview
Property Type : read-only
Accepts : boolean
WebViewStringSet webview string
Property Type : read-write
Accepts : text
ZoomEnabledSets whether the WebView should support zooming using its on-screen zoom controls and gestures
Property Type : read-write
Accepts : boolean
ZoomPercentSets the zoom of the page in percent. The default is 100
Property Type : read-write
Accepts : number

6.Open Source

This extension is open source so that anyone can modify and improve it :innocent:
Here is the repo on GitHub:

You can find changelogs and beta aix there.
CustomWebView has two helper extensions named BrowserPromptHelper (adds your app to Browser's list) and DownloadHelper (for downloading files).

7. Snippets

Download blob files:

Please donate some amount to keep me motivated :heart:

https://pay.upilink.in/pay/vknow360@apl




Hope this helps ! :grin:

43 Likes
From Website to App
When Webview get file upload option start support
Webviewer Website Login PHP
Webviewer page loading problem
No consigo ejecutar un alert o un promt
How Save the file frome internet?
Scrolling screen
:bar_chart: [Free] ChartMakerPlus - an extension to make google charts
How do you link sites create with php/myadmin and hosted freely by 000WEBHOST to my app inventor?
Please I need help to load a page in the web viewer
The vue.js website is not working proper on webview
Javascript onkeypress event not working in webviewer
Crash in webviewer when clicking mailto link
Uploading photos via an internet form does not work via the app's "WebViewer"
Important please help
How do u select info from websites
How do you get the text from a returned web page through either Web or WebViewer components?
📻 WebView Radio Stream Player
Setting web-viewer to desktop mode
Iframe in Webview
ESP32 - CAM OV2640. Module. WebServer
How do you create app PDF printer named or other name PDF scanner extension?
How do you use the CustomWebView.GoToUrl component using a Web component set to a correct url
Webview url dont fit to screen
Descargar desde visor web
Hyperlink not working
Connect cam ip login
Web view video not playing
Download PDF inside webview
How do I delete magnifying glass?
QR Code scanner not working
Download and view PDF's inside AI2 app through webviewer
New tabs not showing in Webview with Custom webview Extension
Action call problem within WebViewer
Webviewer does not save cookies, what to do?
I want to remove size buttons
Webviewer don't work
WebViewer and links inside web pages
I need Help in web viewer please
. Cannot upload files to Google form through app 2. Button click Won't open mail compose menu in my external gmail app
CustomWebView and attempt to open download
Webviewer does not load
Click on web component
Não consigo fazer download no aplicativo
Remove WebViewer Zoom In/Out Button
URL not working in webview with nb187
Translating web pages in my app
Problema web vew
Web view come faccio a caricare un app quando la mia è in esecuzione?
Website to app downloads doesn't work
Create new profile in web view like chrome
How do I add a key when posting a image?
Turn site to app
Webview not present the info
computer mode browser app inventor
Enable TLS 1.2 for Android WebView
Webviewer not showing permission requests
I need to get captcha image with webview
Loading problem with elementor index on site created with wordpress
Webviewer? como hago para abrir un enlace de whatsapp sin que me salga error
WebViewer and Onclick Event with a clock
Requires MODIFY_AUDIO_SETTINGS and RECORD_AUDIO. No audio device will be available for recording
Save information webviewer
Searching help for ' google maps plus code ' does not have many results
Web view app and file/camera/photo permission
CustomWebView Runtime Error: No method named `CreateWebView'
Webview Not Working in offline mit app inventor?
Joystick move mouse
Webviewer no me permite subir archivos desde formulario html
Error 1101: Unable to get response with the specified URL:
Problems with AI2's Web Viewer browser and embedded videos
How do I download a file from a website in a webviewer?
Mon application web n'upload plus les images après l'avoir ouvert dans une application webviewer
"Choose an Action" Pop-up
Problems reading NFC Card
Change button color by swipe
Mit App Inventor Missing Network Issue
Why does the diagram that I made on the web not appear on mit inventor
Image viewer with zoom
Barcodescanner do not work in my case
View PDF in webview
Subir archivos desde app inventor desde VisorWeb1
How to print QR code generated in the Canvas to thermal printer in MIT APP Inventor 2?
How to print QR code generated in the Canvas to thermal printer in MIT APP Inventor 2?
Not loaded picts files not reacted on button in WebView
How can I integrate MIT App Inventor with my WordPress site?
Hi, I found a free chat box named 'tawk.to' and placed the chat box link within webview block in mit app inventer. Its working fine except 'file upload' feature. Can someone help?
Dynamic Components & CustomWebView help
Camera and location doesn't work when I convert website using webviewer
Download link in app not work
URL to APK, but no sound for notification
Browser webviewer
Insert possibility to download all files from app
WebView can not open private URL
File upload and geolocation blocks functions!
Custom DNS in WebViewer
How can I make it so I can right click (Or Long-click in this case) to copy an image using the CustomWebView extension?
To Open email link eg, abcd@gmail.com while clicking on it in webview page⁸
Imported JS running as a html needs access to the microphone, how do I grant it?
Button Choose Image Not Working on webview?
App to upload videos
How to request microphone access for the webviewer?
What are some cool helpful extensions that ''Everyone should have''?
Permisos en appinventor2
Logging into discord
Application Error
Hi, i need to use Call Web_Viewer .Load HTML Block like in Kodular, but i cant find it
Help with discord link
CustomWebViewer help
Webview offline loading mode extension.
Pagina php con camara
Problem with app loading webviewer
Webviewer extension for Video, audio, images, gif, pdf upload
Problem with web app
How can I configure CustomWebView to make TaifunTools' KeepScreenOn feature work for only one specific page of my website?
Why My web cam notconnected
How do you open in appinventor url that use JS?
No me permite acceder a la camara para subir un archivo
How can i block specific URLs
How can i block specific URLs
How do you allow app users to drag and arrange the order of ListView elements as they wish?
Download external file from webviewer
Radio App Problem
Help in custom web view
After turning my Website to Android App, i cant login
Simple WEB browser
WebViewStringChange block
Making a web browser with CustomWebView and TaifunTextbox. Crashes when URL entered
:yellow_square: WebViewExtra - Upload/Download Files with webviewer (and much more...)
Problem in the upload file in webview app
Webview isn’t working
How do you get and send cookies on appinventor?
Who can make a Custom Webviewer extension?
Webview isn’t working
Přístup aplikace k uložišti telefonu (App access to phone storage)
Problem with Google OAuth2 and Firebase REST API: Missing Initial State Issue
How would I use buttons to scroll on WebView?
WEBVIEWER doesn't work
Load WebViewer from Document Directory?
:yellow_square: WebViewExtra - Upload/Download Files with webviewer (and much more...)
Using webview instead webbrowser from device
Enabling Full Javascript functionality within webview for external websites
Help for my chat app
Can't load a specific webpage
WebViewer stuck on "Loading" for a specific URL, but works in browser
about rive runtime anrid
Permission Error in the APP
HTML rendering in the Label component
Buttons don't click inside the web viewer but in chrome website the buttons works fine
Upload file to web with webviewer component not working
Need the custom webview extention
Help me for webviewer
Problema per tornare indietro
How do you convert html5 game to app inventor apk?
Can i trust WebViewer?
How can i made a HTML viewer?
Password protected website (popup)
Affichage de cartes
How to update the permissions in manifest file
MIT App Inventor 2 & Highcharts data.csv configuration with RSSI and Distance Variables
How to unzip file in internal storage?
Convert a dynamic website to an android app
How do you send and receive data from an external api using Web / WebView?
How can I run new window on webviewer?
Come fare Upload da app?
WebViewer dont show videos (it just show a blank space)
InnerHtml Tabledata
Problem with Back button

Looks promising. It doesn't appear as a visual component though, when I drag it onto the screen? It gets placed as a non visual component. How is it supposed to display html content?

2 Likes

Hi @Andy_Bulka Welcome
You will have to manually create webview in an arrangement.
You can find more information here:

6 Likes

Sry silly question... ofc CustomWebView is itself a Dynamic Component
:sweat_smile:

I wanted to create it via DynamicComponentsExtension and asked myself why it didn't work like it supposed to do for me

3 Likes

Yes after latest update of his extension.
But there is no need to use it with his extension if you are using a version greater than >= v6.

3 Likes

I got this error when trying to create a WebView in Vertical Scroll Arrangement:

ScrollView can host only one direct child

Any reason?

2 Likes

No need to discuss, just something I ranodmly discovered, this is not a problem

3 Likes
ChangeLog Version5

New blocks

Changes

  • Added secondaryUrl parameter in LongClicked event
ChangeLog Version6

New Blocks

Changes

  • Added 'id' parameter in CreateWebView method

  • Added 'mimeType' and 'isCaptureEnabled' values in FileUploadNeeded event

  • Removed most of the designer properties
  • Some internal changes
  • Fixed grammar and spelling mistakes
ChangeLog Version7

New Blocks




Bug Fixes

  • Fixed bug in PrintWebContent method
  • Fixed bug in FileUploadNeeded method

What's new

  • Ad Blocker
ChangeLog Version7.1 (Patch Update)

Changes

  • Re-added some properties to designer
  • Added missing permissions

Bug Fixes

  • Fixed bug in LongClickable property

Version 7.1: com.sunny.CustomWebView.aix (64.0 KB)


CustomWebView - lite

Presenting just another variant of CustomWebView.
Note: This version can run even on Api 11 i.e. Honeycomb

Blocks



Documentation
Most of blocks work same as original version except this new event:

  • OnSwipe
    Event raised when left or right swipe occurs in webview.It returns 1 for left swipe and 2 for right swipe.

    direction ~ int

Aix
com.sunny.CustomWebView.aix (14.0 KB)

6 Likes

Oh yeah! This is EXACTLY what I needed!!! Thank you very much! I wanted to make a Slideshow with Gifs, and this is now possible thanks to you!
:hugs:

5 Likes

That's why it is lite version :wink:

3 Likes

I, vknow360 aka Sunny Gupta, attest that I am the author of the CustomWebView extension , grant that the extension included in this project is free and that MIT has a non-exclusive irrevocable license to republish the extension as part of the project file for the purposes of the MIT App Inventor Hackathon 2020.

Thanks to @Yoshi :heart_eyes:

4 Likes

Thanks, now I have everything for my app :grin:

3 Likes

Problem solved forgot about the container :sweat_smile:

2 Likes

Version 8:

5 Likes

Set UserAgent not working in a companion/compiled app, getting "403 disallowed_userAgent" when attemptng google sign up? (Tried five different user agents, all without ;wv)

2 Likes

Hi @TIMAI2
Can you share your blocks and respective User Agents?

2 Likes

Hi Sunny

Is your extension working with HTML files, stored in App Assets, AI2 version nb184? The native WebViewer component cannot load files from anywhere, though it was perfectly fine in nb183.

1 Like

I have not tested it yet.
Let me check.
But android version plays an important role here.
(I can test it only on Kitkat,Lollipop and Nougat)

1 Like

Please see your PMs

1 Like

ChangLog Version 9

Documentation

  • AfterArchiveSaved
    Event raised after 'SaveArchive' method.If 'success' is true then returns file path else empty string.
    image
    success ~ boolean
    filePath ~ text
  • GetInternalHistory
    Get internal history of given webview.
    image
    id ~ int
    Returns: list<String>
  • InvokeZoomPicker
    Invokes the graphical zoom picker widget for this WebView. This will result in the zoom widget appearing on the screen to control the zoom level of this WebView.Note that it does not checks whether zoom is enabled or not.
    image
  • LoadWithHeaders
    Loads the given URL with the specified additional HTTP headers defined is list of lists.
    image
    url ~ text
    headers ~ List<List<String>>
  • SaveArchive
    Saves the current view as a web archive
    image
    dir ~ string
    Note: Use absolute path here

Hope it helps!
Thank you.

4 Likes