HTMLViewer: Xojo + JavaScript Communication

Just calling attention to the fact, not activating an urgent demand. :grin:

2 Likes

Yes you can, I just tried it in macOS. I put in the HTMLViewer this html:

<!doctype html>
<html>
<head>
<script type="text/javascript">
function doButton()
     {
     executeInXojo ('somecommand', 'Have this string for grins.'); 
     }
</script>
</head>
<body>
<input type="button" value="Click me" onclick="doButton()">
</body>
</html>

I added the JavaScriptRequest event handler to the HTMLViewer, and it fired and its arguments contained the values from the javascript.

I was somewhat relieved to see this, since, as has been correctly pointed out, the Xojo example is all driven from the Xojo side. There’s no unsolicited action from the HTMLViewer side. If that turned out to be impossible, I couldn’t do my plan to retire my Websocket Server from my app.

1 Like

What about IE11? Does that help. You have to not only have IE11 installed on your machine, you also have to force it to render in IE11 mode. See here:

https://documentation.xojo.com/api/deprecated/htmlviewer.html

and be sure to do all thie things listed under Windows IE version. I discovered all those things myself the hard way (which is why they are now documented on that page).

Hmmm. Just tried it myself in my Win7/10 VMs, nothing happens. Guess I’ll have to try in the debugger under 2020r1

Yeah, we already determined that you must use the WebKit renderer for this functionality.

https://forum.xojo.com/t/desktop-html-viewer-fail-with-2020-r1/56379/46?u=anthony_cyphers

Are you saying it’s not possible at all with the IE-11 (native) renderer? I keep having to beat this stuff into submissison under Windows, I’ve been successful so far.

Am I 100% sure? No, as I haven’t tested it myself. Would I be surprised? No. This type of functionality isn’t easily achieved (and may not be possible in some cases) in the IExplore COM object on all supported versions of Windows, so it makes more sense to put it in a known environment.

Well, for my plan to retire my WebSocket Server to be possible, I would need this under Windows too, so I’ll keep looking into it. Just the other day, I found yet another setting that has to be correct under Windows for my WebSocket stuff, even only to to localhost, to have permission to work under Windows 10.

Well, I’ll keep trying and report back if it seems possible. I’ve somewhat rapidly put this small test together, errors in it are not excluded. :grin:

You can use it on Windows. You just switch the renderer to WebKit and do away with all of your workarounds that make the Native renderer limp along.

Doesn’t that add 100Mbytes to the executable?

It adds a number of support DLLs, yes, but 100MB in the modern age of computing is nothing especially for such a useful addition to your application that will save you many hours of pain. Especially once it’s all compressed by an installer.

3 Likes

OK, I give up. Looks like it’s not implemented.

But here’s a subsidiary question. With Safari development under Windows having ceased some years ago, who is doing WebKit development under Windows now? Is that Xojo?

Xojo’s Windows WebKit implementation is using the Chromium Embedded Framework. It’s an open source renderer that many popular browsers are built upon, including the new version of Microsoft’s Edge, Chrome, Brave, and many others.

1 Like

Ah, OK, thanks for that. I’ll think about whether to switch to that for Windows. It’s actually an extra 150Mbytes, but your point still stands since jousting with IE has actually been a pain.

1 Like

I ALWAYS use CEF instead of the alien systems of unknown results found in the machines. If just found the bug/inconsistency because I forgot doing so in my simple test.
100Kb is nothing for such benefit. To be true, I wish we had 3 options, Native, Webkit and CEF. And I wish CEF for using it ALWAYS in Mac, Windows and Linux for better consistency.

I have a Feedback Case for providing CEF on all platforms, but I’m not at my desk so I can’t grab the ID. You should do a search and add some points to it.

2 Likes

The problem is that I don’t believe in the points system of Xojo. Sometimes not in the feedback constantly closed without deeper examination, or whatever. PDF has been in the system for 10 years full of points.

While I understand your frustration, that’s the system we have currently for expressing such needs, and not participating in it is a sure fire way to make sure your needs aren’t met.

Either way, that’s a discussion for another topic.

2 Likes

If you find it any time later, call me here or pm, and I will add points just because you requested it and I am able to do so.

1 Like

Here you go! <https://xojo.com/issue/50301>