mootools/mootools-core — Issue #2202: Uncaught TypeError: Property 'scrollTo' of object [object DOMWindow] is not a function
Author: RiZKiT
Created: 2012-01-17 15:44:17+00:00
State: open

We are remotly logging javascript errors. One error which appears more often is:

> Uncaught TypeError: Property 'scrollTo' of object [object DOMWindow] is not a function

and in the following code:

```javascript
scrollTo: function(x, y){
if (isBody(this)){
this.getWindow().scrollTo(x, y);
} else {
this.scrollLeft = x;
this.scrollTop = y;
}
return this;
},
```

After investigating the problem I found out it is a result of a popup blocker for Chrome, which seems to overwrite scrollTo().

Do you have any clever solution how to prevent that error, for example by checking in core if `typeof window.scrollTo() == "function"`, or set `scrollTo() = function(){}` when not defined? Or something else. Best solution would be to check it only once, maybe at `Window.implement`?

I can prevent the error from logging, but the error still occurs at the user. Chrome cannot be ignored any more and popup blocker aren't that unusual these days. So I hope you don't say "You have to live with it.".