42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
// Browser windows size collector
|
|
window.onresize = function (event) {
|
|
SetWidthHeight();
|
|
}
|
|
function SetWidthHeight() {
|
|
var height = $(window).outerHeight();
|
|
var width = $(window).outerWidth();
|
|
//var height = $(window).height();
|
|
//var width = $(window).width();
|
|
//$(window).innerHeight() * $(window).devicePixelRatio();
|
|
|
|
//w = window.screen.width;
|
|
//h = window.screen.height;
|
|
//if (window.devicePixelRatio < 1) {
|
|
// w = window.screen.width / window.devicePixelRatio;
|
|
// h = window.screen.height / window.devicePixelRatio;
|
|
//}
|
|
|
|
|
|
$.ajax({
|
|
url: "./windowSize.ashx",
|
|
data: {
|
|
'Height': height,
|
|
'Width': width,
|
|
'PixRat': devicePixelRatio,
|
|
'scrWidth': screen.width,
|
|
'scrHeight': screen.height
|
|
},
|
|
contentType: "application/json; charset=utf-8",
|
|
dataType: "json"
|
|
}).done(function (data) {
|
|
if (data.isFirst) {
|
|
window.location.reload();
|
|
};
|
|
}).fail(function (xhr) {
|
|
alert("Problem to retrieve browser size.");
|
|
});
|
|
|
|
}
|
|
$(function () {
|
|
SetWidthHeight();
|
|
}); |