So, I have this button in the .html file:
This works, but when I have this code on a button (so I can click it when the html is certainly loaded.
Here I get “gEditor is not defined”. What could be the issue here?
Thanks for pointing me in the right direction.
Well, I mean the issue here is that
gEditor is not defined. This one will be hard to sort out without the project.
You might consider changing the thread’s title to include any third party libraries you are using to attract the author of those libraries to your thread for an answer.
Hi @Tim Parnell Thanks for your answer.
There are not really third parties involved, but I tried to choose a better title but it seems that I cannot change my first post.
I recreated the most minimal version I could of this problem so it would be clear what problem I’m facing.
So pushing that button just works, the function is called, the string is added and an alert is shown.
I could found nothing about this in the docs.
The “global” vars of the IFrame page are only global for the page they are defined in, but not for the parent enclosing it.
You can try to access them like this:
"var testInstance = document.getElementsByTagName(""IFRAME"").contentWindow.testInstance;" + _
"testInstance.TestMethod(" + chr(34) + "hello" + chr(34) + ");" _
…but you will run into the following limitation (called “cross-domain restriction” or “same-origin policy”):
Aha, that’s too bad. Both my scripts run on localhost, but on a different port, a webserver for my files :8081 and Xojo standalone on :8080.
Will have to look into CGI to get them on the same domain I guess. It would be really helpful if this would work: https://forum.xojo.com/41840-add-folderitems-to-host-in-standalone/p1#p340158 but there seems to be no way to use the Xojo standalone is a webserver to host other files than the webapp itself.
Edit: Even better than CGI, I can use this technique: https://en.wikipedia.org/wiki/Web_Messaging
Thanks for your help!
You can actually. Look at WebFile.
You might also want to look at the docs for the WebSDK in the extras folder. It may help you get your libraries to the browser before your code executes.
[quote=340581:@Greg O’Lone]You can actually. Look at WebFile.
You might also want to look at the docs for the WebSDK in the extras folder. It may help you get your libraries to the browser before your code executes.[/quote]
Thanks Greg for the WebFile knowledge. This is amazing, my gut told me already that I was doing a really weird practice, actually running 2 webservers etc.
The WebSDK looks really amazing. But the library I’m using is a little to big to convert to a control I’m afraid. It’s the BabylonJS 3D Game engine. Would be amazing to address is directly, but I don’t think my JS knowledge would be good enough, and I’m afraid it would take me months to convert all methods etc.
[quote=340605:@Mathias Maes]Thanks Greg for the WebFile knowledge. This is amazing, my gut told me already that I was doing a really weird practice, actually running 2 webservers etc.
The WebSDK looks really amazing. But the library I’m using is a little to big to convert to a control I’m afraid. It’s the BabylonJS 3D Game engine. Would be amazing to address is directly, but I don’t think my JS knowledge would be good enough, and I’m afraid it would take me months to convert all methods etc.[/quote]