CustomWebView : An extended form of Web Viewer

Hi,

I use WebViewString to communicate between html and app.
To be able to send many data, i use JSON. So when a Button is clicked in APP ( or whatever event you want ) you can prepare JSON string to contain your data for the HTML. and send the JSON as WebViewString.

In HTML you have to catch WebViewString change event (with javascript) and process the JSON data.
And the opposite, when you click a Button or whatever event you want, prepare JSON string and send it back to app with WebViewString.

Parse the JSON and take your options/data.

3 Likes

It is not working for me on Android 5.0 (Tested in Companion)

My Blocks:

Result:

2 Likes

ChangeLog Version 8

New Blocks





Changes

  • Added id parameter to OnNewWindowRequest and removed the url parameter
  • Clicked url will open Screen1 with list of url and 1
  • Web Shortcut will open Screen1 with a list of url and 2
  • Events will be only triggered for active webview (Set using SetWebView method)

Bug Fixes

  • Fixed bug in UploadFile method
    Thanks to @nikzdreamer2001 and @wwwmaster2006 for reporting the bug
  • Fixed bug in CurrentId method (it was not resetting after removing webview)
  • Fixed bug in GetCookies method (it was returning null instead of empty string)
    Thanks to @sonumohammad333 for reporting bug

Documentation

Since first post is no longer editable (lag issues) so here is documentation for new blocks.

  • On Close Window Request
    Event triggered when a window needs to be closed
    image
    id ~ int
  • Create Shortcut
    Creates a shortcut of given website on home screen
    image
    url ~ text
    iconPath ~ text
    title ~ text
  • Load In New Window
    Loads requested url in given webview
    image
    id ~ int
  • Pause WebView
    Does 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.
    image
    id ~ int
  • Post Data
    Loads the URL with postData using ‘POST’ method into active WebView.
    image
    url ~ text
    data ~ text
  • Resume WebView
    Resumes the previously paused WebView.
    image
    id ~ int
  • Set Cookies
    image
    url ~ text
    cookieString ~ text
  • Initial Scale
    Sets the initial scale for active WebView. 0 means default. If initial scale is greater than 0, WebView starts with this value as initial scale.
    image
    Accepts int

Thank you everyone :heart:

11 Likes

You are awesome

I just reported the bug
You fixed it in a glance

2 Likes

CAn anyone explain onnewwindowreq blocks plz…

1 Like

this can help you:

3 Likes

Ok thanks will try it :+1:

2 Likes

I don’t know, if it’s a mistake or if I misconfigured the extension but it was commented on a website and asked me to log in to Facebook so I could post my comment but I click the start button and nothing appears, not even a pop-up window

1 Like

Hello again.
Image upload problem still continues.

I tried one by one with file: //, content: // and image: //. But the result has not changed.

It gives an error like this: Duplicate showFileChooser result

1 Like

Have you enabled FileAccess ?
It should be enabled if you want to upload files.

You will have to handle pop ups from yourself using OnNewWindowRequest and LoadInNewWindow.
Also be sure to check if Js is enabled.

2 Likes

:frowning: Can you tell me how I can do this?

2 Likes

Using this property block.

3 Likes

Where am I doing wrong?
file-upload-5

You are setting property without creating webview.
You can set property only after creating webview and making that webview to active.

3 Likes

Thank you so much. You are wonderful :slight_smile:
It has worked smoothly right now.
I will have one last request from you;
After the user clicks the file upload button, can we offer new photo taking and photo selection from the gallery at the same time?

Oh okay,
But if you can give a example from the last one you wrote because i don’t understood good

OSM Extention . Well done. You Great extention for free. You are good extention developer. :heart:

2 Likes

Welcome :slightly_smiling_face:

Yes you can.
Simply show a bottom sheet with options for uploading files like camera, gallery, sound recorder ,etc.
But I would like to mention one thing that it is not recommended to capture images using a camera or recording sound using a sound recorder unless isCaptureEnabled is true.

See here:
id used as parameter is local variable.

Thank you. :hugs:

2 Likes

Ohh Thank you!

1 Like

hi sunny friend, my creator get struck when i post all the ad codes, pls say me solution

3 Likes