CustomWebView : An extended form of Web Viewer

Hey @vknow, I tried using the camera component. The camera did pop up. However it did not able to detect the image being captured by the camera.

Hi Sunny - version 12Beta has been out in the wild for some time now - time for the official release?

1 Like

Sure, after doing some more tests I'll release it soon.

v12 has been finally released.
Thank you everyone for testing it and giving your precious feedbacks.

3 Likes

I am facing a performace issue while using Custom Web View and Web view in the MIT AI2 Companion. I am trying to render a 3 dimensional web game in an app. Using the normal browser, I can easily get 60 frames per second. However, using web view, it is dropping to 20 frames per second. Is there any way to optimize the performance of applications which are using web view and custom web view?

1 Like

After upload my app new version...google sent this mail.what should i do know?

It is quite clear.
How are you handling SSL errors?
Visit an unprotected site in Chrome and you'll see this.

To solve this, you need to handle the error correctly.

image

Hey i want help! i have problem on customwebview. how do i make custom webviewer appear?

CustomWebView is a non visible component.
You take a container( horizontal or vertical arrangement) , create an instance of webview inside that and then use it like a normal webviewer.
Please read few posts of starting of thread, atleast.

1 Like

read the whole thread, there are so many examples

2 Likes

thanks lot

// v12beta

    @SimpleEvent(description = "A new request is intercepted or recorded <br> Added by Xoma")
    public void RequestIntercepted(String url, YailDictionary requestHeaders) {
        EventDispatcher.dispatchEvent(this, "RequestIntercepted", url, requestHeaders);
    }

I found this in the source code, but can not find this in the blocks.

Is there a way to expose this 'shouldInterceptRequest(WebView view, final WebResourceRequest request)' to user? @vknow360

Not officially, but you can compile the sources.
I'm curious to know how you'll utilise that.

SimpleEvent will not work, since we need to return WebResourceResponse.

We need a procedure with a result.
Maybe we can add a property to indicate which procedure will be called if RequestInterception needed.

Response contains headers which are returned as a dictionary.

finally I add a property InterceptDict, and when shouldInterceptRequest method is called, it will look up in InterceptDict.

} else if (interceptDict.containsKey(request.getUrl().toString())) {
				String newpath = interceptDict.get(request.getUrl().toString()).toString();
				InputStream is = null;
				String mimeType = null;
				String encoding = null;
				try {
					if (newpath.toLowerCase().startsWith("http://") || newpath.toLowerCase().startsWith("https://")) {
						is = new URL(newpath).openConnection().getInputStream();
						mimeType = URLConnection.guessContentTypeFromStream(is);
						encoding = "UTF-8";
					} else {
						String path = context.getExternalFilesDir(null).getPath() + "/" + newpath;
						is = new FileInputStream(path);
						mimeType = URLConnection.guessContentTypeFromStream(is);
						encoding = "UTF-8";
					}
				} catch (Exception e) {
					
				}

				if (SdkLevel.getLevel() >= 21) {
					HashMap headers = new HashMap();
					headers.put("Access-Control-Allow-Origin", "*");
					return new WebResourceResponse(mimeType, encoding, 200, "OK", headers, is);
				}
				return new WebResourceResponse(mimeType, encoding, is);
			}
1 Like

If you can, I would appreciate a PR. It will be useful indeed.

Sorry I still don't know how to PR.
Anyway, you are free to modify/add this code in your next release if you want.

Snippet:- (1)

How to ask for location permission?

Snippet:- (2)

How to handle SSL errors?
image

Snippet:- (3)

How to handle JS events?

1 Like

I created a browser using the CostumWebView extension and I cant find a way to make multiple tabs possible, does anyone know how?

1 Like