Solved

Is there a way of ensuring Iframe contained page refreshes to top each time?

Posted on 2010-11-16
7
268 Views
Last Modified: 2012-05-10
Hi,

I have an Iframe which points to 3 child forms pages which step through ie 1 of 3, 2 of 3 and 3 of 3. The problem is that 2 of 3 is a very long page and one has to scroll down to get to the button "Next" which then shows a blank page because the parent Iframe is still scrolled down and the 3rd page is short. Is there a way to ensure that each time the child window is "nexted" the new child page has its focus top left, rather than its current position. Unfortunately I have very limited control over the child windows since it is a 3rd party payment application.

Thanks,

Sam

0
Comment
Question by:SamJolly
  • 4
  • 3
7 Comments
 
LVL 51

Expert Comment

by:HainKurt
Comment Utility
use scroll(0,0) on your steps

here is a sample called from a button
Top<br>

<p> a long text here </p><p> a long text here </p><p> a long text here </p><p> a long text here </p>

<p> a long text here </p><p> a long text here </p><p> a long text here </p><p> a long text here </p>

<p> a long text here </p><p> a long text here </p><p> a long text here </p><p> a long text here </p>

<p> a long text here </p><p> a long text here </p><p> a long text here </p><p> a long text here </p>

<p> a long text here </p><p> a long text here </p><p> a long text here </p><p> a long text here </p>

<p> a long text here </p><p> a long text here </p><p> a long text here </p><p> a long text here </p>

<p> a long text here </p><p> a long text here </p><p> a long text here </p><p> a long text here </p>



<button onClick="GoToTop()">scroll top</button>

<script>

function GoToTop(){

  scroll(0,0);

}

</script>

Open in new window

0
 
LVL 51

Expert Comment

by:HainKurt
Comment Utility
in your case just add

<script>
function GoToTop(){
  scroll(0,0);
}
</script>

<body onLoad="GoToTop()"...>
0
 

Author Comment

by:SamJolly
Comment Utility
Kurt,

Thanks for this. The trouble with this solution is that I would have to add it to the child pages and I cannot do that as they are 3rd party. So I was wondering whether there was a way from the parent Iframe page to control this behaviour?

So to clarify:

IFrame Page
      ChildForm1  - Short Page
             Next
       ChildForm2 - Long page
             Next
       ChildForm3 - Short Page - Stays at bottom therefore looks blank which is the problem. Manually scrolling the parent iFrame scrollbar back up reveals the form on the 3rd page. So how can this be done automatically from the Parent iFrame Page?

Thanks,

Sam
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 51

Expert Comment

by:HainKurt
Comment Utility
if they are in the same domain yes, you can control from parent
if they are running on different domains, you cannot (for security reasons)
0
 
LVL 51

Accepted Solution

by:
HainKurt earned 500 total points
Comment Utility
if they are in same domain you can use

<iframe name=frmChild id=frmChild src="http://same.domain.com/somepage.aspx"></iframe>

<button onClick="GoToTop()">scroll frame to top</button>
<script>
function GoToTop(){
window.scroll(0,0);
  var frm = document.frames["frmChild"]
  frm.scroll(0,0);
}
</script>
0
 

Author Comment

by:SamJolly
Comment Utility
Kurt,

They are in different domain so I guess that I am out of luck.

I will now discuss the situation a bit with the 3rd party to see if they can add the JS, but I am not hopeful !!

Thanks for your help,

Sam
0
 

Author Closing Comment

by:SamJolly
Comment Utility
thks
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now