Detect Metro UI Version of IE

后端 未结 11 1783
轻奢々
轻奢々 2020-12-02 21:22

What\'s the fastest method, to detect User-Agent as metro UI version of internet-explorer >=10 ?

11条回答
  •  情歌与酒
    2020-12-02 21:34

    I tested the following and it works, a jsfiddle showing this can be found here.


    This is a bit of long shot, but seems quite a sensible solution:

    Why not check whether the browser is full screen1 and depending on that call the fullscreen one metro. I have windows 8 running on my computer at work, so I will try to check tomorrow whether there are any GUI's still around (don't think I remember any) and if so, you would need to manually subtract them. True, it's not the most beautiful solution, but as far as I know there won't be any 'beautiful' solution and this could prove to be a pretty solid hack, as the GUI of metro IE can't be changed with any toolbars or similar software (as far as I know). True, it could lead to a misidentification of the desktop IE, but even that is within reason, as a fullscreen desktop IE will still give a similar experience.


    1 Giving something along the lines of:

    if(window.innerWidth == screen.width && window.innerHeight == screen.height) {
      // metro
    } else {
      // desktop
    }
    

提交回复
热议问题