Let's bring this question back from the dead ;) There is a reason Google doesn't give you a simple solution. Special cases and browser quirks affect the calculation, and it is not as trivial as it seems to be.
Unfortunately, there are problems with the solutions outlined here so far. I don't mean to disparage them at all - they are great starting points and touch on all the key properties needed for a more robust approach. But I wouldn't recommend copying and pasting the code from any of the other answers because
they don't capture the effect of positioned content in a way that is reliable cross-browser. The answers which are based on body size miss this entirely (the body is not the offset parent of such content unless it is positioned itself). And those answers checking $( document ).width() and .height() fall prey to jQuery's buggy detection of document size.
Relying on window.innerWidth, if the browser supports it, makes your code fail to detect scroll bars in mobile browsers, where the width of the scroll bar is generally 0. They are just shown temporarily as an overlay and don't take up space in the document. Zooming on mobile also becomes a problem that way (long story).
The detection can be thrown off when people explicitly set the overflow of both the html and body element to non-default values (what happens then is a little involved - see this description).
In most answers, body padding, borders or margins are not detected and distort the results.
I have spent more time than I would have imagined on a finding a solution that "just works" (cough). The algorithm I have come up with is now part of a plugin, jQuery.isInView, which exposes a .hasScrollbar method. Have a look at the source if you wish.
In a scenario where you are in full control of the page and don't have to deal with unknown CSS, using a plugin may be overkill - after all, you know which edge cases apply, and which don't. However, if you need reliable results in an unknown environment, then I don't think the solutions outlined here will be enough. You are better off using a well-tested plugin - mine or anybody elses.
Thanks. Quite a bit complicated! If you don't want to/need to be backward compatible is there perhaps an easier solution for html5 browsers? I mean perhaps the browser coders/w3c have been nice enough to just tell us if there are scrollbars or not on an element? ;-)
@Leo Not that I am aware of. Well, there is a window.scrollbars object which has a single property, visible. Sounds promising but isn't. It is not supported in IE, including IE11. And it just tells you that there is a scroll bar - but not which one. See the test page here.
Thanks @hashchange. It sounds incredible stupid that it just tells if there is any scrollbar so I guess it is just some kind of test yet. A bit promising though. ;-)
@BT Ok, great. Now let me lead you to the entrance of the rabbit hole ;) Here's a demo where the content is not enough to fill the window. Your detection works in FF but fails in Chrome. And here's another demo where a positioned element is placed far down the page. Your detection works in Chrome but fails in FF.
@BT And I guess we can get into a bunch of weird failure modes when we begin to play with overflow settings because their behaviour is a little odd, but I've stopped right there.