Set main window's view from iframe code (scroll to top)

My team is developing an Atlassian Connect app for Jira. Our iframe is loaded to an admin page (by using adminPages module) without using any options when referencing all.js, so the iframe itself is sized to its content and an outer scrollbar appears in the main window. So far so good.
The problem is that, when we scroll down and click a link in the iframe, the new content appears in the iframe, but the view is not scrolled to the top.

I know the documentation mentions this:
“Child pages have no access to its parent’s DOM and JavaScript properties”
https://developer.atlassian.com/cloud/jira/platform/about-the-javascript-api/

Is it possible anyhow to make the main window’s view to scroll to the top?

It’s a limitation of javascript. The best thing would be to use AP.navigator (Navigator ) and have it load a new adminPage using the key.

Are you able to set the options on the frame to fill the parent and then handle scrolling internally inside your iframe?

i.e. add this attribute to your all.js script tag data-options=“sizeToParent:true;resize:false”

Then inside your frame set overflow-y: scroll on body.

@daniel @jkells
Thanks for the tips!

@edave suggested to use the following function which does exactly what I needed:

Calling AP.scrollPosition.setVerticalPosition(0); scrolls to the top of the iframe. Although some more was needed as there’s some header text in the parent frame, so I used this: AP.scrollPosition.setVerticalPosition(-999);

I’ve just found that the AP.scrollPosition.setVerticalPosition works fine in Chrome and Firefox, but not in Microsoft Edge. Is that a bug? Do you know any solution or workaround for it?