Android Question How to save image when load Url with Webview1

Ajws

Member
Licensed User
Hi all,

do you know a way to save image with webview1 url ?

** like a browser in desktop, we can right click > save image as.....
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

Ajws

Member
Licensed User
Once you get the image url it is easy to download it with OkHttpUtils2.

You can inject JavaScript to make all images clickable and then get the src attribute to find the image url.

Relevant links: https://stackoverflow.com/questions/26098866/jquery-img-clickfunction-selector-not-working
$(this).attr('src') will return the src attribute. You can change the window location based on the src and then catch it with the WebView_OverrideUrl event.
how can i inject javascript... i didnt know.... can you give me example link
 
Upvote 0

Ajws

Member
Licensed User
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim Button2 As Button
    Dim WebView1 As WebView

End Sub

Sub Button2_Click
    WebView1.LoadUrl("javascript:alert('Hello World')")
End Sub

i do this, but didn't happen...
 
Upvote 0
Top