Do you know that you can use your iPhone, iPad or Macbook as a basic seismometer, the same device that is used to measure the magnitude of earthquakes and volcanoes?

OK, try this.

Launch the Safari browser on your iOS device, or Google Chrome if you using a Macbook, and then open this page – Now shake your phone /computer and the website will capture these movements in real-time much like a seismograph.

The seismic intensity will vary depending on how vigorously (or slowly) you are shaking the phone and will also change based on the orientation of the device. And you’ll be surprised to learn that this basic seismograph is written using few lines of JavaScript.

The idea in simple English is something like this. Apple laptops and mobile devices have a built-in accelerometer. As you move the hardware, the changes in the orientation of the device are detected and reported to the browser which then maps this new data into the seismograph.

The JavaScript, that produces the seismograph, works only with Chrome and Mobile Safari and here’s why. It relies on two events – DeviceOrientation and DeviceMotion – to detect motion and the events are only supported by the two browsers mentioned earlier.

I tested this on an iPad 2 with mobile Safari and it worked just perfect.