Javascript 在Windows Phone 8上的IE10中查找屏幕分辨率

Javascript 在Windows Phone 8上的IE10中查找屏幕分辨率,javascript,html,css,windows-phone-8,internet-explorer-10,Javascript,Html,Css,Windows Phone 8,Internet Explorer 10,我正在尝试为windows phone 8制作一个需要全屏分辨率的web应用程序 似乎没有办法发现这一点 使用: 这将永远是320 使用javascriptscreen.width返回320 使用javascriptscreen.availWidth返回320 我已经整理了一些代码,这些代码目前似乎正在运行: JavaScript: window.devicePixelRatio = window.devicePixelRatio || screen.deviceXDPI / screen.lo

我正在尝试为windows phone 8制作一个需要全屏分辨率的web应用程序

似乎没有办法发现这一点

使用:

这将永远是320

使用javascript
screen.width
返回320

使用javascript
screen.availWidth
返回320

我已经整理了一些代码,这些代码目前似乎正在运行:

JavaScript:

window.devicePixelRatio = window.devicePixelRatio || screen.deviceXDPI / screen.logicalXDPI;
var actualWidth = screen.width * window.devicePixelRatio;
actualWidth = actualWidth - (actualWidth % 2);
var actualHeight = screen.height * window.devicePixelRatio;
actualHeight = actualHeight - (actualHeight % 2);

// TEMP FIX!
if(actualHeight == 1282){
    actualHeight = 1280;
}

$(window).bind('resize', function() {
    if(window.innerHeight > window.innerWidth){
        // portrait
        width = actualWidth;
        height = window.innerHeight;
    }else{
        // landscape
        width = actualHeight;
        height = window.innerHeight;
    }

    $('html').css('width', width);
    $('body').css('width', width);
}).trigger('resize');
CSS:

在WindowsPhone8上有没有更好的方法来找到真正的屏幕分辨率


如果您对这个问题有任何帮助/建议,我们将不胜感激,谢谢

使用javascript,此代码将在任何设备上运行:

var width = window.innerWidth;
var height = window.innerHeight;

感谢您的回复,不幸的是,这不是HTC 8X(720x1280)上的答案:如果我在视口中使用此选项,则得到320x521如果我在没有视口的情况下使用此选项,则得到1024x1667Oh,好的。谢谢你让我知道。
var width = window.innerWidth;
var height = window.innerHeight;