473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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.location.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 4972
On 5$B7n(B14$BF|(B, $B2<8a(B2$B;~(B58$BJ,(B, Brent <writebr...@gmail.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.location.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.scrollLeft:window.pageXOffset;
document.Form1.scrolly.value = (document.all)?
document.body.scrollTop: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
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
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)...
19
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(). ...
10
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...
6
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...
1
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...
3
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...
0
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...
3
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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,...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.