Return to Snippet

Revision: 18847
at October 9, 2009 17:10 by rportela


Initial Code
getPPI : function(){
	var DOM_body = document.getElementsByTagName('body')[0];	
	var DOM_div = document.createElement('div');
	DOM_div.style = 'width: 1in; visibility:hidden;';
	DOM_body.appendChild(DOM_div);
	var w = document.defaultView.getComputedStyle(DOM_div, null).getPropertyValue('width');
	DOM_body.removeChild(DOM_div);
	return parseInt(w);
}

Initial URL

                                

Initial Description
Outputs the number of Pixels Per Inch in the current Device

Initial Title
Get PPI of the current device displaying your page

Initial Tags
javascript

Initial Language
JavaScript