Scroll Iframe parent to top

Hello,
I have a webpage with an Iframe. In the iframe i am running a Xojo webapp. When pushing a button in the webapp I need to scroll to parent page of the iframe to the top. Usually I would use a JavaScript code like „window.parent.scrollTo(0,0);“ . But how do I do this with Xojo? Of course I tried this code with ExecuteJavascript in the buttons action but that does not work :wink:

Both the app and the web app must be on the same server for that to work. Otherwise, you cannot access the parent page.

Hello Michel,
thanks for your reply. Both, the webpage end the webapp currently run on localhost. I Xojo I do:

WP_Registration.ExecuteJavaScript("window.parent.scrollTo(0,0);")

I get that error:

Could not execute returned javascript: window.parent.scrollTo is not a function. (In 'window.parent.scrollTo(0,0)', 'window.parent.scrollTo' is undefined) Source: window.parent.scrollTo(0,0);

I think the problem is, that I do not understand how to reference the iframe and the iframes parent from Xojo.

http://stackoverflow.com/questions/935127/how-to-access-parent-iframe-from-javascript

Hello Michel,
thanks, that was very helpful. I used the example with the „postMessage API“ from your link and it works!