I have a web application where I have embedded a webhtmlviewer with HTML code and a few JS functions. These JS functions are both embedded and come from another site. I am attempting to call a JS function from a XOJO webbutton action handler. I only push this Xojo button after I now the whole webhtmlviewer is displayed.
Any suggestions on how I can access this wtt function from a Xojo button?
Unless the content of the webHTMLViewer is on the same site as your app, that won’t be permitted, since the content is into an iFrame (the WebHTMLViewer).
Since you say the content comes from another site, it simply won’t be possible.
You’re trying to XSS, which is blocked by your browser.
You should serve the website inside the webhtmlviewer from your webapplication.
The moment I served the html pages from within my webapplication, everything worked like a charm.
If you have no control over the content served (i.e.: It’s someone elses website), you’re out of luck. It won’t be possible. And that’s no limitation of Xojo whatshowever. That’s just the way internet works (is secured).
@Mathias Maes , I took a look at that stream before submitting my question and I didn’t think it applied. Going through it again, I might have been wrong. I will try to host the JS file on my server to see if that gets me past the issue.
The HTML is on my server, while the JS and images are on another one (worldwidetelescopes.org). I’ll try and move the JS to my server to see if that helps.
Unfortunately after a bunch of testing, I’m unable to place the JS on my server. This is because some of the information that is provided is dynamic (comes from a .Net application on World WideTelescopes.org). I’m going to have to keep digging.
You should ask them if they have an API to get the data you want. Then you’d be able to use and display it however you like.
Edit…link to their API: http://www.worldwidetelescope.org/docs/worldwidetelescopewebcontrolscriptreference.html#WebControlDevelopment
@Phillip Zedalis , that is the conclusion I’m coming to as well. My hope was to be able to smoothly move from one star to another, but it looks like that is just not possible. Thank you to everyone who has added their thoughts to this problem.