button on html

Hi Guys,

I had an html page that is loaded to webhtmlviwer. There are lots of object in there
My question Is it possible to detect click of a button from htmlviwer to xojo ?

I don’t think there’s a direct way, but you can do it indirectly. :slight_smile:

You could have your button in the WebHTMLViewer call App.HandleSpecialURL using AJAX Post passing the data you want to pass along with the WebSession.Identifier and WebPage.Name.

Then in App.HandleSpecialURL, use WebApplication.SessionWithIdentifier to find the session. Then use WebSessionContext to call a method on the Page that would pass the data from the button.

It’d be incredibly helpful if we had more events for WebHTMLViewer.

This is clever, but it works only if you created the page. If this is on another site, security will prevent accessing the content of the WebHTMLViewer.

I tried you advise from webhtmlviewer with a google map. xojo dont catch any click in the map.
Any advise?

This is precisely what I was explaining above. You cannot get to the content of a WebHTMLViewer when another site is displayed. It is an iFrame, and as such for security reasons, the content is protected.

There is no way around.

[quote=431808:@ronaldo florendo]I tried you advise from webhtmlviewer with a google map. xojo dont catch any click in the map.
Any advise?[/quote]

Do you have control of the Google Map code? If so, change your button code to call https://YourWebAppDomain.com/api/YourParams

Then when you click you’ll see App.HandleSpecialURL fire. :slight_smile: