Setting scroll position in Internet Explorer
What I feared had happened. I developed a web page amd tested it in Opera, and it doesn't work in IE6.
This is the code snippet: Code:
<script type="text/javascript"> In other words, retrieving the scroll position works fine, but setting of the scroll position does not. Alternatively I tried this code: Code:
<script type="text/javascript"> As a matter of fact, there seems to be no relationship between what I put the scroll position to, and the real position after the call. These are a number of requested positions, and the real position the scroll position moves to: Code:
requested actual In Opera it works perfectly. In Firefox it does not, but that is due to a (documented) different way of specifying the scroll position. If anyone ever succesfully scrolled the window in IE to a predetermined position, please let me know! jlinkels |
Not exactly an answer to that, but...
I'd try and have it jump to a named anchor in the page, which is more or less the same result. |
Yes, I know that technique as well.
I am afraid it is not fine grained enough. The application is running on an intranet, with a dozen or more controls. Whenever a control is changed, the contents is written to MySQL, and the page is refreshed. Since this process is fast, it should look like the page is remaining in place. That is hardly possible with bookmarks. I agree that the user sees the page again in more or less the same position, and that would be satisfactory if the page is away for 2 seconds or so while refreshed. In the mean time I have made some progress. If I put the scrollTo(x,y) statement in the <body onload="blah blah"> tag, it works in IE as well. Not as beautiful as in Opera though, first the entire page is loaded and THEN it scroll to the desired position, which is not nice to the eye. (Think about that, it is in the onload statement...) In Opera it remain satisfactory. Now I am beginning to understand why so often web sites don't in Opera which do in IE. It is IE not complying to the specifications forcing developer to write eeky code, not the other way around. jlinkels |
All times are GMT -5. The time now is 02:03 PM. |