iPhone and iPad rotation

How do I detect the rotation of an iPhone or for that matter any device in a web app?

http://documentation.xojo.com/index.php/WebSession.OrientationChanged

Thanks Michel