How can I make it so I can right click (Or Long-click in this case) to copy an image using the CustomWebView extension?

(I'm fairly new to MIT app inventor so I would appreciate some patience be allotted going into this. Thank you in advance!)

I'm making an app that allows me to access web views of social medias, (Discord, Reddit, Pinterest, etc.) but I have no way to right click an image or item to copy an image to then be able to CTRL + V it elsewhere.

For example, when the CustomWebView URL is set to discord, I can rightclick to copy an image in one conversation to be able to post it in another view CTRL+ V.

Can anyone show me any pictures of blocks that can help me out?

If you could help me write out the Javascript code, that would me amazing! I know next to nothing about Javascript

Your previous respondent was a bot.

You will probably need five things:

The method for your chosen webview to inject/run your javascript to your web page
A javascript Event Listener for image clicks
A javascript conversion from image to base64
An understanding of the webviewstring for returning the base64 string to your app
An extension to convert the base64 string back to a binary image file

You can find all of these through web searches (AI responses) and by searching the community

If you want to copy an image from one webpage to another inside a webview, this may be dependent on the web page functionality (you have found that you can do this with discord).

I've been looking around for the things you've recommended (Thank you for the response by the way!) but I'm having trouble figuring out how to format the Javascript in a single line text block.

I have a few more questions as well:

  • The CustomWebView extension has an OnLongClick block; can I use that to detect a long click?
  • CWV also has an EvaluateJavaScript block, is that viable or do I have to find another way to inject the Javascript
  • How can I get the copied base64 to reconvert into an image file, do you have an extension you can point me to?

Overall I've made very little progress, and would honestly appreciate some further help, you've helped turn me in the right direction, but I'm not completely there yet. Thank you!

Sit back, relax and have a good read through the customwebview topic:

Look for base64 extensions here:

App Inventor Extensions | Pura Vida Apps

(you are unlikely to get all of this into a single line of javascript code...)