Mouse management in JavaScript games
<p>Im using JavaScript, the HTML5 canvas-element and WebGL to make a simple 3D-game in first person view for fun.</p>

<p>Ideally, I would like to control my movement by using the keyboard to move and the mouse to look around, like you usually do in FPS-games. As you probably understand, there are some limits to this in the browser, since the mouse cant be captured:</p>

<ul>
<li>When using the <code>onmousemove</code> event, no further movement will be detected when the mouse pointer reaches the border of my screen (which means that I wont be able to run in a circle for example)</li>
<li>Seeing the mouse move across the screen is not the end of the world, but it is a little annoying</li>
</ul>

<p>From what I know, it's impossible to hide the mouse as well as setting it's position in JavaScript. <strong>Hence, my question is this:</strong></p>

<p><strong>If we cant to those things, what can we do in order to get close to the desktop gaming experience when it comes to the mouse in the browser?</strong></p>

<p>And I mean right now, using current APIs. Not "what could be changed in some standard to make life easier". Also, I realize that I could use the keyboard to look around, but then we're back in 1995 when Quake were actually played like that. And of course I know that it would be easier to write a desktop application or use Flash at least, but Im trying to push JavaScript's limits here.</p>

<p><strong>Apart from those things, what are your suggestions? Any kind of reference, existing game, crazy idea, hack or even browser specific solution would be appreciated.</strong></p>
