I've made an online ruler tool as my first js project as a part of a learning process.
Here's how I do it:
First I estimate ppi
ppi = settings.ppi = settings.ppi_x = document.getElementById('testdiv').offsetWidth ;
which is usually bad value. After user 'calibration' I calculate true ppi according to user's input of real device diagonal in inches:
ppi = Math.round(Math.sqrt(w*w + h*h)/diag*10)/10;
where w,h are width and height of the screen (window.screen.width)
You can check out the ruler here: realruler
My question is
a) Is there any better approach of doing this? more accurate?
b) I've managed to test this on pc and android, so I was wandering, is there anywhere some free iOS testing environment where you can work online on real iphone device?
Tx,
Alex