Question: I'm trying to determine how many pixels down I've scrolled using `window.scrollY`. But this isn't supported in IE8. What is the safe, cross-browser alternative?

Answer: 
The cross-browser compatible version for `window.scrollY` is `document.documentElement.scrollTop`. Please see the 'Notes' section of this piece of [**Mozilla documentation**](https://developer.mozilla.org/en-US/docs/Web/API/window.scrollY?redirectlocale=en-US&redirectslug=DOM/window.scrollY) for a full, detailed workaround in IE8 and before.

[**As mentioned here**](http://help.dottoro.com/ljnvjiow.php), `pageYOffset` is another alternative to window.scrollY (note though that this is only IE9+ compatible). 

In regard to the link above, check **Example 4** for a fully compatible way to get the scroll position (it even accounts for zoom as @adeneo mentioned!) using `document.documentElement.scrollTop` and `document.documentElement.scrollLeft`. 

[**Here, try out the example for yourself!**](http://help.dottoro.com/external/examples/ljnvjiow/scrollTop_4.htm)
Based on Mozilla, and answers above, I have a created the functions below to more easily get the coords:

```js
var windowEl = (function () {
    var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat");
    function scroll() {
        return { left: scrollLeft, top: scrollTop };
    };
    function scrollLeft() {
        return window.scrollX || window.pageXOffset || (isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft);
    };
    function scrollTop() {
        return window.scrollY || window.pageYOffset || (isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop);
    };
    return {
        scroll: scroll,
        scrollLeft: scrollLeft,
        scrollTop: scrollTop
    }
})();

```

According to the [Mozilla documentation](https://developer.mozilla.org/en-US/docs/Web/API/window.scrollY?redirectlocale=en-US&redirectslug=DOM/window.scrollY), as cited by lifetimes above, the The `pageXOffset` property is an alias for the `scrollX` property, so is stictly speaking not necessary.

Anyhoo, usage is:

```js
var scroll = windowEl.scroll();
// use scroll.left for the left scroll offset
// use scroll.top for the top scroll offset

var scrollLeft = windowEl.scrollLeft();
// the left scroll offset

var scrollTop = windowEl.scrollTop();
// the top scroll offset

```

Tested & works on Chrome, Firefox, Opera, Edge (8-Edge), IE (7-11), IE8 on XP