Can't initiate triggerServerEvent

i have this code

Self.ExecuteJavaScript("if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { var coords = position.coords.latitude + ',' + position.coords.longitude; if (typeof Xojo !== 'undefined') { Xojo.triggerServerEvent('LocationReceived', coords, false); } else { console.error('Xojo framework not ready'); } }, function(error) { if (typeof Xojo !== 'undefined') { Xojo.triggerServerEvent('LocationFallback', '', false); } else { console.error('Xojo framework not ready on fallback'); } }); } else { if (typeof Xojo !== 'undefined') { Xojo.triggerServerEvent('LocationFallback', '', false); } else { console.error('Xojo framework not ready on no geolocation'); } }")

that should trigger server events. Whether I run this from Opening Session or From Shown on the WebPage, I still get “Xojo Framework not ready” instead. What might be causing this?

Hi Maurice, that’s part of the Web SDK. It’s meant to be used by SDK controls and it’s used internally by the Xojo framework itself.

What are you trying to achieve? Isn’t WebLocation control enough?

2 Likes