HTMLViewer copy image address

I need to copy the text from a HTMLViewer picture to a text field. I have look at the examples, but can not find anything on where to paste from the system clipboard. The information should be a string.
I have xojo 2024 R2 and and linux
I also want this to work on windows 10

If you use the URL from the HTMLViewer to pull the source using a URLConnection, you can parse it and get the needed information. This should be possible on mac,win,lin,…

Mostly like described here: HTML-source code as a string - #5 by Riccardo_Tani

I need to get the text containing just the image address. Usually a website has several pictures on it. When I right click on a picture within HTMLViewer the following 4 menu items in a contextual menu.

Open image in new window
Save Image AS
Copy Image
Copy Image Address
Where is this information stored? Is it stored in the system clipboard, and how do I access the “Copy Image Address” information?

Did you look at the documentation on Clipboard?

The example on that page shows how to grab Text from the clipboard, like so:

// create an instance of the clipboard to access what is stored there
Var c As New Clipboard

// check for textAvailable
If c.TextAvailable Then
  // text is available, so put the value somewhere your app can access it
  TextField1.Text = c.Text
End If

// make sure you close the clipboard object afterwards
c.Close

i did look at the clipboard documentation before posting. For some reason the HTMLViewer does not seem to put the string value in this clipboard. I tried putting that code in the mouseup event for HTMLViewer. The TextField1.Text never gets populated. What am I doing wrong.

Well, I don’t remember the details, but you should know the Xojo HTMLViewer control is not a full-fledged browser. There are some limitations, which I think are mostly related to security, so it wouldn’t surprise me that the clipboard functionality is restricted.

So with that said, I know you can inject your own JavaScript to get information out of the page loaded in the HTMLViewer, via either the ExecuteJavaScriptSync or ExecuteJavaScript methods. Also look into the JavaScriptRequest event, which explains the use of executeInXojo() and executeInXojoSync() functions that you can use in your JavaScript inside the control. I hope that helps.