Solved

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

Posted on 2010-11-16
7
304 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 51

Expert Comment

by:Huseyin KAHRAMAN
ID: 34147486
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:Huseyin KAHRAMAN
ID: 34147506
in your case just add

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

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

Author Comment

by:SamJolly
ID: 34147788
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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
LVL 51

Expert Comment

by:Huseyin KAHRAMAN
ID: 34148318
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:
Huseyin KAHRAMAN earned 500 total points
ID: 34148476
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
ID: 34149832
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
ID: 34149841
thks
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
original content 7 78
displaying 3 dropdownlist  horizontally 3 32
How Close unsubmited attempts 10 45
How do I post more than 1 item to php backend 24 31
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

749 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