I have an HTML textarea (not Xojo TextArea) defines
<body>
<form>
<textarea name="editor1" id="editor1"></textarea>
I need to extract the text within editor1. I can extract the Source from ChromiumBrowserMBS.MainFrame but the textarea contents is not amongst it.
Is this a frame? I tried to define a ChromiumFrameMBS for the texture (below), but it returns nil.
Dim tempChromiumFrameMBS As ChromiumFrameMBS = tempChromiumBrowserMBS.Frame("editor1")
I cannot find anything on the forums or MBS web site to help.
I’ve been wrong once today so this could be 0 for 2, but I’m feeling confident in this one
The ChromiumFrameMBS is not the actual content of the page, but in reference to the view / scrolling ability of the HTML Viewer. It does not manipulate the page you have loaded up.
I read elsewhere that you were at least able to successfully extract the HTML source of the page using MBS, you may have to extract the source and parse it to find the textarea and it’s contents.
You should get html via our plugin.
But you may prefer to run some javascript to get the textarea.
e.g. “document.title = document.getElementByID(‘editor1’).value”
I have been exchanging not so nice mail with them, as it seems not only do they mess up with HTML5 standard, but they would not hear of relations with other developers.
From what I could see by exploring the DOM, they place the text within a DIV. But they also fill it with tags.
Thanks to all. I tried transferring the JavaScript via document.status, but found that document.title works better since the Status is used for many other commands.
Dim tempChromiumBrowserMBS As ChromiumBrowserMBS = myHTMLViewer.ChromiumBrowserMBS
if tempChromiumBrowserMBS <> nil then
tempChromiumBrowserMBS.ExecuteJavaScript(myCommand)
end if
Thanks Tim. Yes I can extract the Source HTML on macOS using MainFrame.data, but this doesn’t work for Windows and doesn’t contain the text I type into my texture.
When I use ChromiumFrameMBS.Source it gives me the surrounding HTML, but not the contents of this field (which also has HTML incidentally). Sometimes this subfield many have around 32K of text, but no images or files.
I have a JavaScript routine that extracts the data I need, my only issue is where to put it so I can read it in Xojo.
My point is not to use the Javascript hack because it doesn’t work for you due to the limitations.
For now it’s probably best to use the plugins to get the whole page source, parse that to find the <textarea> you’re looking for, and extract it’s contents all in Xojo code.
In other words, there is nowhere to put your Javascript routine because it will not work on Windows.
[quote=322379:@Tim Parnell]For now it’s probably best to use the plugins to get the whole page source, parse that to find the <textarea> you’re looking for, and extract it’s contents all in Xojo code.
In other words, there is nowhere to put your Javascript routine because it will not work on Windows.[/quote]
Tim, whenever I get the Source of the HTMLViewer it includes the structure of the textarea, but not the content of the textarea. I am happy to do the extraction with Xojo, but how have you manages to retrieve the source code with the textarea contents included?
Okay, so it’s giving you the source that was loaded, not the actual current state of affairs.
Makes sense now as that’s what you see when you go to View Source in your browser (navigating the DOM with developer tools is a different tool.)
The only other thing I can recommend is to see if ChromiumFrameMBS.Text gives you anything useful.
This weekend I’m updating HTML Edit to chunk up data and pass it out through TitleChanged, as there doesn’t seem to be much of another solution even with plugins.
[quote=322565:@Tim Parnell]
This weekend I’m updating HTML Edit to chunk up data and pass it out through TitleChanged, as there doesn’t seem to be much of another solution even with plugins.[/quote]
Thats what Travis told you on the unsupported hacks thread
The browser engines themselves dont give you a way to get at much - even with their SDK’s
[quote=322572:@Norman Palardy]Thats what Travis told you on the unsupported hacks thread
The browser engines themselves dont give you a way to get at much - even with their SDK’s[/quote]
I know, and I understand there’s nothing Xojo can really do about it. That’s why I have to change my implementation.