javascript - Window.screen in Internet Explorer and more than one monitor -
i have dual monitor setup different screen resolutions , when visit this page in chrome shows right resoltion both screens. ie shows resolution of primary screen. appears in ie window.screen.availwidth
, window.screen.availheight
returns values primary screen. can screen resolution second screen running internet explorer?
using ancient code found @ http://archive.cpradio.org/code/javascript/dual-monitors-and-windowopen/
function findleftwindowboundry() { // in internet explorer window.screenleft window's left boundry if (window.screenleft) { return window.screenleft; } // in firefox window.screenx window's left boundry if (window.screenx) return window.screenx; return 0; } window.leftwindowboundry = findleftwindowboundry; // find left boundry of screen/monitor function findleftscreenboundry() { // check if window off primary monitor in positive axis // x,y x,y s = screen, w = window // 0,0 ---------- 1280,0 ---------- // | | | --- | // | | | | w | | // | s | | --- s | // ---------- ---------- if (window.leftwindowboundry() > window.screen.width) { return window.leftwindowboundry() - (window.leftwindowboundry() - window.screen.width); } // check if window off primary monitor in negative axis // x,y x,y s = screen, w = window // 0,0 ---------- -1280,0 ---------- // | | | --- | // | | | | w | | // | s | | --- s | // ---------- ---------- // works in firefox @ moment due bug in internet explorer opening new windows negative axis // however, can move opened windows negative axis workaround if (window.leftwindowboundry() < 0 && window.leftwindowboundry() > (window.screen.width * -1)) { return (window.screen.width * -1); } // if neither of above, monitor on primary monitor whose's screen x should 0 return 0; } window.leftscreenboundry = findleftscreenboundry; console.log(window.screen.width); console.log(window.leftscreenboundry()); console.log(window.screen.height);
i know it's not much, @ least allow assess if client on dual monitor set , how wide set is.
the f*ed thing ie distribute resolution evenly among montors.
so takes total width , divides number of monitors.
i have 3 monitors, 2 @ 1920 x 1080 , 1 @ 1600 x 900 testing , ie gave left position 1745 0 -1745 yea... off ie in all, hopefull little snippet you, or else bit further making semi compatible code ie.
Comments
Post a Comment