how do I get the viewport position relative to the screen?
<h3>My question</h3>

<p>What JavaScript code will tell me where the <strong>viewport</strong> of the <strong>browser</strong> is located relative to the <strong>screen</strong>?</p>

<h3>Context</h3>

<p>My web application includes an applet that allows taking a snapshot via <em>java.awt.Robot</em> (the applet's jar is of course signed and is privileged to perform this).</p>

<p>The problem is that Robot's <em>createScreenCapture</em> works with rectangles relative to the entire screen, whereas I want to capture a rectangle relative to the viewport.</p>

<p>A browser can obviously be anywhere on the screen, but even if it is maximized (and therefore begins at the top left of the screen, i.e. {0,0}) I still don't know how much the content is pushed down because of the window header or some toolbars.</p>

<h3>My research so far</h3>

<p>It seems only IE gives the viewport position through <em>window.screenTop/Left</em>.</p>

<p>Chrome supports these, but they hold the browser position.</p>

<p>FF doesn't support these, instead it has <em>screenX/Y</em>, but like Chrome they hold the browser position.</p>

<h3>Making sure we all use the same terminology</h3>

<p><strong>Screen</strong> - AKA the desktop. for example I have a WSXGA+ (1680x1050) display. I use Windows and my taskbar is always shown at the bottom so it consumes about 50 pixels vertically.</p>

<p><strong>Browser</strong> - a window that may or may not have various toolbars: address and/or bookmarks bar at the top, status/add-on bars at the bottom, etc.</p>

<p><strong>Viewport</strong> - where a URL is actually being rendered.</p>
