CustomWebView : An extended form of Web Viewer

GuessFileName is the best way to get file name from url.
But if it does not work as expected then what you can do it to split url at / and select last item of the list.

Oh! No Url doesn't have file name :cry:

Then in that case, since you have file extension (mp4) so you can make a random file name and suffix file extension to it.

I don't know how to go about this tho, i don't understand yet, but about extracting name from the url, is it from the final download url?

httpss://storage-31.dsto.store/46e4084471cadb48f887a17/EP.1.v0.1699238407.360p.mp4?token=DVRBOxMmOI684h5GNNMCzw&expires=1699255181&id=394049&title=

I added an extra s because mp4 file was embeded here

This is the direct download link of an mp4 and the title starts from EP.1.VO, can the name be collected from this section ?

Hello, thank you all for creating this incredible community. I have a question which is How to solve the below issue:

Runtime Error

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

Most probanly you try to create webview using as container a table arrangement instead of a Vertical Arrangement

WebviewHArrangement - accepts horizontal arrangement
WebviewVArrangement - accepts vertical arrangement

image

2 Likes

Hi, I'm trying to download the contents of the web portal I created (and now I wanted to create its app). I tried to download the payrol but despite or following the guides, if I click on the button nothing happens and the page zoom there is no way to remove it. how can I do? I attach the blocks that I inserted following your examples

What happens when you pass Download as downloadDir ?

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