473,769 Members | 6,499 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reload parent while maintaining current scroll position.

I have a child page opened with a simple open() statement. I'd like to
be able to refresh the parent page and keep the current scroll
position. (If I do an "F5" refresh on IE, for instance, the page will
return to the last position it had.) Is there any "easy" way to
accomplish this?

I've been using

window.opener.l ocation.reload( );

but this returns the page to the top. I also tried setting up a bunch
of <a nameanchors, and scroll to these, but this scrolling places
the anchor at the top of the page, which isn't always where the scroll
was before.

Thanks for any pointers.

--Brent
Jun 27 '08 #1
2 5010
On 5$B7n(B14$BF |(B, $B2<8a(B2$B; ~(B58$BJ,(B, Brent <writebr...@gma il.comwrote:
I have a child page opened with a simple open() statement. I'd like to
be able to refresh the parent page and keep the current scroll
position. (If I do an "F5" refresh on IE, for instance, the page will
return to the last position it had.) Is there any "easy" way to
accomplish this?

I've been using

window.opener.l ocation.reload( );

but this returns the page to the top. I also tried setting up a bunch
of <a nameanchors, and scroll to these, but this scrolling places
the anchor at the top of the page, which isn't always where the scroll
was before.

Thanks for any pointers.

--Brent
Hi Brent,

Try saving the scroll position in some hidden fields before the form
gets unloaded,
like this:
document.Form1. scrollx.value = (document.all)?
document.body.s crollLeft:windo w.pageXOffset;
document.Form1. scrolly.value = (document.all)?
document.body.s crollTop:window .pageYOffset;
Then use
window.scrollTo (scrollx, scrolly);
after the form loads to scroll to the position you saved.

Hope that helps.

Roger
Jun 27 '08 #2
Thanks for your help, Roger. I ended up simply writing the values one-
by-one to the parent page, rather than refreshing to grab them. This
solution seemed to satisfy the client the most.

--Brent
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2144
by: Emmanuel | last post by:
Hi, I use a 'reload all' feature in my app, that allow to reload every module. I first try this version : import sys def Reload():
3
7373
by: Martin RAYROLE | last post by:
Hi folks, Does somebody know how to reload a page without moving to the top of the page ? I have tried the two following commands : 1) window.location=document.location; 2) location.reload(); but, each time, the scrollbar is moved to the top of the page.
19
31071
by: Darren | last post by:
I have a page that opens a popup window and within the window, some databse info is submitted and the window closes. It then refreshes the original window using window.opener.location.reload(). The problem is that after the reload, it brings you right to the top of the page. When I click 'refresh" on the original page, it brings me back to the original viewing position. Is there a way to duplicate this in from the popup window. Also,...
10
4029
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
6
15065
by: PD | last post by:
I have a parent .Net page (http://mywebsite/project.aspx) that has an iframe (http://iframe/iframe.aspx) which are on seperate domains. I need to adjust the scrolling on the parent window due the size of the iframe. It displays a rather lengthy message which causes scrolling on the parent page (not in the iframe) which is what the UI folks want. I need to be able to scroll the parent page from a click in the iframe. After they read this...
1
3817
by: Raffi | last post by:
Hi, I have an application screen with a CSS scroll area. Users click links in the scroll area which open small popup windows to enter data. When the data is submitted, the popup reloads the opener to update the page and closes itself. However when the parent page is updated, the div scrolls back to the top. Is there a way to have CSS remember the vertical scroll position and go back to it when the page is reloaded? Similar to...
3
5981
by: jagann2007 | last post by:
Hi all, I have a webpage with an IFRAME in it. But some of the pages on my IFRAME which has forms which are really long. So, I want a script or a html code whereby I can scroll to the top of the page once the user finishes with a certain page. Also, the IFRAME does not have a scroller, but the parent page does. So basically, putting my question more specifically, is it possible to use a submit button in the IFRAME to scroll to the...
0
1506
by: Sobin | last post by:
I am new to ASP .NET. In my webpage there is a panel with vertical scroll bar enabled.Inside the panel there is a treeview control.I'm populating its nodes at run time through database connection.The nodes are large in number, sothat I've to scroll down to view the last nodes. The problem is that when I scroll down to see the bottom most nodes,the scroll bar goes back to the initial position.ie,I'm able to view only the first few nodes.I...
3
6391
by: sungung | last post by:
Hi group, I want to back orginal scroll postion after reload page. Is it possible? My situation is call popup windows -enter data on popup -close popup -refresh parent page -reload data. As you know, scroll position will be 0,0 after reloading page. But I want to go the postion where user click the link for popup windows.
0
9587
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.