CustomWebView : An extended form of Web Viewer

Nothing is happening. I press the button to download the file but nothing happens.

Post aia.

trai@gmail.com
abc123456

last icon left (document)
JSMARTED.aia (109.8 KB)

You are using WebViewer and then expecting CustomWebView to download files.
Strange.

and what can I do for my case? you understand I'm new. I only ask that from my site it is possible to download files that do not always have a precise address. I don't want to rebuild an entire application, but just make sure that the files can be downloaded from the site and that the zoom is removed.

You should use this extension then.

1 Like

Thank you for this very useful extension, which I have been using for some time for my study projects and applications.
Now I have a little problem with a project:
when in a page open in the Web View there is a link that requires the opening of another window, I would like to open the window not within the application, but externally with the device's browser, so as to leave the application with the window containing the source page.
I know how to do it, i.e. with ActivityStarter, but I can't start it because I don't have an event that makes the URL available to pass to the Activity Starter.
The "OnNewWindowRequest" event would be ideal, but there is no URL parameter to pass to the functions to start the Activity. Would this be perfect to implement, or do you have a better solution?
For example, the Web Viewer built into App Inventor has an event called "BeforePageLoad" which would be equally perfect for what I would like to do, but I can't use that component because it lacks other essential features and configurations.
Thanks again for your work.

No, it is not possible to get url from new window request without opening it in a new webview.
Either you do that externally or I do in the extension itself, both are same.

Any particular reason?

Yes, a video is playing in the application window and this could be interrupted by a click on a link to a content present on the page that recalls a URL of an external page; in the case of opening a window with the device's browser, the video stops at the point remaining paused in the application, ready to resume execution from where it left off when the user goes back and/or closes the browser.
However, in the case of opening the link with a new window within the application (obviously with a different ID or with the same one if you put false multiple windows), when you go back, the video page is reloaded and the video starts again from the beginning.
It's like simulating opening a new tab (or window) in desktop browsers, or following the behavior of the most common mobile applications such as YouTube.
Thanks for your reply, your extension is truly excellent and if this function could be implemented it would be perfect!

Hi Sunny, I have an update...
Working with the WebView IDs and methods that you made available in the extension, I was able to simulate the behavior I was interested in, even pausing the video when I open the link in a new window and resuming it from the pause point by returning.
This means that my compliments to your work are deserved.
The fact is, however, I would not want the user to be able to browse external sites (not hosted by me) with a view within the application and I would always prefer to open the links with an activity that calls the device's browser.
The application shows videos (hosted by me) which may have external links to my hosting in the descriptions.
This is why an implementation of the function I was telling you would be perfect.
Thanks again for your attention.

Enable AdBlock.
Make a csv list of external hosts present in the page and set this to AdHosts property.

These hosts won't be loaded after clicking links.

Thanks for the advice, but I can't do this.
The links could also be ads that cannot be excluded from the projects, and then the procedure is not standard.
If you don't plan to include this feature (i.e. an event that returns the URL on the user's click before loading), I will try to solve it differently, without taking anything away from your splendid work.
Thank you

hi @vknow360 .
I got two issues:
1.
in OnConsoleMessage, if the message is an object, it will use show us [object Object], is it possible to serialize this object to string?
2.
the tag video will show an ugly icon like below, if no video is playing.
image
is it possible to remove this, make it just like on browser on pc?

No, the output is from webpage and can't be modified once obtained.

It is possible to replace icon but then you'll have to provide a custom image.
There is getDefaultVideoPoster() method in WebChromeClient class.

        @Nullable
        @Override
        public Bitmap getDefaultVideoPoster() {
           // return super.getDefaultVideoPoster();
           return myCustomBitmap;
        }
1 Like

Just don't show it in the html, until the video feed is ready ?

1 Like

1-1ads.com,101com.com hello can this ad host work

I tried to download a file on Mediafire and had this problem, does anyone have a solution?

do you have an example URI?
Taifun

It's probably trying to download a blob URL or a data url which isn't supported directly right now. There are examples of how to download both throught the thread.

Hi I have a problem I get this:
Argument #2 (com.google.appinventor.components.runtime.Table...) to 'com.sunny.CustomWebView.CustomWebView.CreateWebView(com.google.appinventor.components.runtime.HVArrangement,int)' has wrong type (com.google.appinventor.components.runtime.TableArrangement) (expected: com.google.appinventor.components.runtime.HVArrangement)
Note: You will not see another error reported for 5 seconds

What I need to do??