I can't remember where, but I saw a JavaScript library, that had it's own database of few dozen tablet/phone devices with PPI (pixels per inch) density. When your device was recognized it returned it's PPI density like this:
device: Nexus 4
ppi: 320
width: 768px
height: 1280px
I unfortunately didn't bookmarked it... tried to google it but no luck.