By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,712 Members | 2,111 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,712 IT Pros & Developers. It's quick & easy.

Browsers not supporting document.documentElement.scrollLeft?

P: n/a
Hi,

I just tested all the browsers I have for support of
document.documentElement.scrollLeft to determine how many pixels the
window has been scrolled to the right. I'm trying to determine if I
really need to go to all the trouble of feature detection for determine
page scroll amount of if the old browsers are old enough now just to
ignore them.

Below are the OS-browser combinations that worked in my test.

OS X 10.4
Safari 2.0.4
Opera 9.00
Firefox 1.5.0.6

OS X 10.3
Safari 1.3.2
Opera 9.00
Firefox 1.5.0.6
(Failed in Internet Explorer 5.2)

Windows XP
Internet Explorer 6.0.2600.000.xpclient.010817-1148
Firefox 1.5.0.6
Opera 9.01

IE 6 was released in August 2001 which is a long time ago so worrying
about IE 5 seems unnecessary for some kinds of web sites. And IE 5 on
OS X is a tiny fraction of people surfing the web.

Does anyone know which are the most recent browsers that would not
support document.documentElement.scrollLeft? Any mobile devices or are
they all running something based on Mozilla or Opera?

Thank you,
Peter

Sep 3 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a


pe**********@gmail.com wrote:

I just tested all the browsers I have for support of
document.documentElement.scrollLeft to determine how many pixels the
window has been scrolled to the right.
Windows XP
Internet Explorer 6.0.2600.000.xpclient.010817-1148
Note that for IE 6 you will need to use
document.documentElement.scrollLeft if it renders the document in strict
mode but document.body.scrollLeft if it renders the document in quirks
mode. So for IE 6 and later you need to check document.compatMode to
decide whether to use documentElement.scrollLeft or body.scrollLeft. And
it seems Mozilla does the same but there I think window.pageXOffset is a
better choice anyway as I think it will work in older versions of
Mozilla too.

For IE 5 and 5.5 on Windows you need document.body.scrollLeft.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 3 '06 #2

P: n/a
Martin Honnen wrote:
>
I just tested all the browsers I have for support of
document.documentElement.scrollLeft to determine how many pixels the
window has been scrolled to the right.
Windows XP
Internet Explorer 6.0.2600.000.xpclient.010817-1148

Note that for IE 6 you will need to use
document.documentElement.scrollLeft if it renders the document in strict
mode but document.body.scrollLeft if it renders the document in quirks
mode. So for IE 6 and later you need to check document.compatMode to
decide whether to use documentElement.scrollLeft or body.scrollLeft. And
it seems Mozilla does the same but there I think window.pageXOffset is a
better choice anyway as I think it will work in older versions of
Mozilla too.

For IE 5 and 5.5 on Windows you need document.body.scrollLeft.
Hi Martin,

Thank you for the reply. I just read the following page about quirks
mode

http://www.quirksmode.org/css/quirksmode.html

I always have following doctype at the top of my web pages

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

so on modern browsers it seems I don't have to worry about my page
being rendered in quirks mode, correct?

So it looks and could just use documentElement.scrollLeft if I am not
concerned with IE 5, 5.5 or earlier Mozilla.

Do you have any idea which version of Mozilla was the first to
implement documentElement.scrollLeft in strict mode?

Thank you,
Peter

Sep 3 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.