<html> <body> <button onclick="alert(screen.deviceXDPI);">device XDPI</button> <button onclick="alert(screen.deviceYDPI);">device YDPI</button> </body> </html>