473,703 Members | 2,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Auto scroll to correct position?

I have a web page (IE only; intranet only) that is both wider and
longer than the browser window. I've noticed that if the user has
scrolled the page DOWN and then refreshes the page, the new page
automatically scrolls down to same position. However, this automatic
scrolling does NOT happen if the user has scrolled over towards the
right side.

Is there a setting that needs to be adjusted to get this to happen? Or
something I need to do in the page?

FWIW, I'm trying to come up with a script that will pass the
..scrollTop and .scrollLeft properties back to the server on a refresh
(and then use .scrollTo to position the new page) but I'm hoping there
might be a simpler way.

Any suggestions?

Thanks.
Jul 23 '05 #1
1 2035
Martin wrote:
I have a web page (IE only; intranet only) that is both wider and
longer than the browser window. I've noticed that if the user has
scrolled the page DOWN and then refreshes the page, the new page
automatically scrolls down to same position. However, this automatic
scrolling does NOT happen if the user has scrolled over towards the
right side. FWIW, I'm trying to come up with a script that will pass the
.scrollTop and .scrollLeft properties back to the server on a refresh
(and then use .scrollTo to position the new page) but I'm hoping there
might be a simpler way.


Since the full process is initiated by javascript, you should rather use
client-side ways of state keeping, for instance cookies or frames - you
could also consider IE behaviors (.htc files).

There's also the following old IE thing (navigator expando), which runs
happily in my current IE; that's probably more a hack than anything, but
since it's been here for years it might as well be used, for instance as
a js include - to be tested accordingly though, I seem to remember it
crashing upon browser closing, but cannot remember the specifics of the
test I tried then (long ago!).
<script type="text/javascript">
if(window.attac hEvent) {
window.attachEv ent(
"onbeforeunload ",
function() {
navigator.scrol lLeft=(
document.compat Mode &&
document.compat Mode.indexOf("C SS")!=-1 &&
document.docume ntElement || document.body
).scrollLeft;
}
);

window.attachEv ent(
"onload",
function() {
if (typeof navigator.scrol lLeft!="undefin ed")
scrollBy(naviga tor.scrollLeft) ;
}
);
}

//test
for(var ii=0,s="";ii++< 100||document.w rite(s);s+=ii);
</script>
HTH
Yep.
Jul 23 '05 #2

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

Similar topics

2
6103
by: PhilC | last post by:
Hi Folks, I'm trying to click on a canvas to draw a line. The canvas has scroll bars. All is well until I move the scrollbars. This naturally because the relationship between my screen click and canvas event.x, event.y has changed. I need something that will add the proportional amount the scroll bar has moved to the mouse click position. I see the terms canvasx and canvasy but they appear to be used for converting screen position to
1
13956
by: Glabbeek | last post by:
I'm changing the layout of my site. Instead of using tables, I will use DIVs. It's working fine, except for 1 thing: In IE6 some DIVs are not the correct width. Mozilla and Opera are showing the page the way I want. Does anybody know a solution for this? First of all, the code I am using: CSS ------- body {
5
11202
by: Duane Lambe | last post by:
Hi - just a quick question, I hope it's simple enough that a visual example isn't required. I have an internal site, everything's the way I want it, but there's an anomoly in both Opera and Firefox, which doesn't exist in IE (surprise). Essentially, it's a div being margin:auto-d on the page. #container { padding: 0;
2
1703
by: lawrence | last post by:
I thought I was fighting a PHP problem, so I asked about this on a PHP list, but they felt it was a Javascript problem, so I'm reposting a bit of the debate here. Could this Javascript, below, possibly trigger a redirect in Netscape, and send the browser to a file called "0". Cause what is happening is on load, in Netscape, the page redirects to something like: http://www.myDomain.com/0
6
29225
by: Rachel Suddeth | last post by:
I have the index of a line in the Lines array of a RichTextBox. I would like to have it scroll so that line displays at the top. Is there no way to do this? The only way I can see to make it scroll is with ScrollToCaret(). But I don't know how to set the "caret" to a particular line. Any suggestions? -Rachel
0
2242
by: 23s | last post by:
Is there any way I can send a vertical value to a form's scroll position? I have a full-screen form that, at launch, contains an empty tab sheet. At run time, the user can dynamically append a rich textbox to the tab sheet. The rich textbox is placed at 0,0 (upper left corner) within the tab sheet and is initially 1 "line" tall to accomodate the user's first line of text. The rich text box is, in actuality, a user control of mine...
1
5163
by: pravinnweb | last post by:
can anyone tell me how to set auto height to outer div that is in green box id "gray-background" it should increase relatively to inner div "smbox" here is the css and html code it should work in FF, IE6 and IE7 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> Employee Listing </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords"...
15
16603
dlite922
by: dlite922 | last post by:
I'm back again, Intro: I've got a floating div (outerDIV) with fixed width that contains an image (IMG) and a div that contains a short text (innerDIV) Problem: In FF, the innerDIV is displaying under the IMG because outerDIV is not wide enough to contain both of them (in some instances). In the instances where the outerDIV is wide, I don't have this problem. IE wraps the text but still keeps it to the right of the IMG. FF doesn't...
12
7865
Frinavale
by: Frinavale | last post by:
I think I'm trying to do something impossible. I have a <div> element with a overflow style set to "scroll". In other words my <div> element allows the user to scroll the content within it. There are a number of elements within this <div> that cause the <div> to participate in an Ajax call to the server. In order to maintain the scroll position of the <div> during the Ajax request I store the scroll value in a hidden field so that when...
0
8654
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
9234
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
9089
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6575
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5910
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
4412
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...
0
4668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2406
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2037
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.