Browsers not supporting document.documentElement.scrollLeft?

P

petermichaux

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
 
M

Martin Honnen

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.
 
P

petermichaux

Martin said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,017
Latest member
GreenAcreCBDGummiesReview

Latest Threads

Top