Any possible way to handle an action between WKWebView and Browser for selecting an image in iOS?
Asked Answered
F

1

11

I want to upload a static image on select of button (as described in below screenshot) <input type="file"> on the web url from my app using WKWebView.

On click of Choose File button it will open default action sheet of device and after the selection of image, it will be uploaded on server. I want to interrupt the flow and upload my static image instead of user's selected image.

enter image description here enter image description here

Is there any observer or listener so from there we can handle request and response. Upload an image using form-data API is not available.

Forecastle answered 4/9, 2018 at 9:43 Comment(2)
I know this is not going to solve your issue, but what exactly are you trying to achieve? Why have a file input if you will ignore it? Why not just send your static image to your server without this useless interaction?Jurkoic
The problem is we don't handle the server and it's the requirement @MihaiFratuForecastle
H
0

You can get a callback from WKWebView's element click action but you need to play with JavaScript code and the JSVirtualMachine which will help to get a callback in your swift class. and then you can do any action on click as like normal action

You can follow this link

Hafer answered 12/9, 2018 at 13:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.