我有一個雙顯示器設置不同的屏幕分辨率,當我在Chrome瀏覽this page它顯示兩個屏幕右側resoltion。但IE只顯示我的主屏幕的分辨率。它看起來比IE window.screen.availWidth
和window.screen.availHeight
只返回主屏幕的值。 我可以獲得運行Internet Explorer的第二個屏幕的屏幕分辨率嗎?Window.screen在Internet Explorer和多臺顯示器
回答
使用在http://archive.cpradio.org/code/javascript/dual-monitors-and-windowopen/
function FindLeftWindowBoundry()
{
\t // In Internet Explorer window.screenLeft is the window's left boundry
\t if (window.screenLeft)
\t {
\t \t return window.screenLeft;
\t }
\t
\t // In Firefox window.screenX is the window's left boundry
\t if (window.screenX)
\t \t return window.screenX;
\t \t
\t return 0;
}
window.leftWindowBoundry = FindLeftWindowBoundry;
// Find Left Boundry of the Screen/Monitor
function FindLeftScreenBoundry()
{
\t // Check if the window is off the primary monitor in a positive axis
\t // X,Y X,Y S = Screen, W = Window
\t // 0,0 ---------- 1280,0 ----------
\t // | | | --- |
\t // | | | | W | |
\t // | S | | --- S |
\t // ---------- ----------
\t if (window.leftWindowBoundry() > window.screen.width)
\t {
\t \t return window.leftWindowBoundry() - (window.leftWindowBoundry() - window.screen.width);
\t }
\t
\t // Check if the window is off the primary monitor in a negative axis
\t // X,Y X,Y S = Screen, W = Window
\t // 0,0 ---------- -1280,0 ----------
\t // | | | --- |
\t // | | | | W | |
\t // | S | | --- S |
\t // ---------- ----------
\t // This only works in Firefox at the moment due to a bug in Internet Explorer opening new windows into a negative axis
\t // However, you can move opened windows into a negative axis as a workaround
\t if (window.leftWindowBoundry() < 0 && window.leftWindowBoundry() > (window.screen.width * -1))
\t {
\t \t return (window.screen.width * -1);
\t }
\t
\t // If neither of the above, the monitor is on the primary monitor whose's screen X should be 0
\t return 0;
}
window.leftScreenBoundry = FindLeftScreenBoundry;
console.log(window.screen.width);
console.log(window.leftScreenBoundry());
console.log(window.screen.height);
發現我知道這是沒有太大的古代碼,但它至少可以讓您評估,如果客戶端是一個雙顯示器設置,並有多寬上集合是。
唯一的F *編了事情IE瀏覽器是均勻分佈的所有montors之間的分辨率。
因此,需要的總的寬度和通過監視器的數目除以它。
我有3個顯示器,2個在1920 x 1080,一個在1600 x 900爲我的測試和IE瀏覽器給左邊的位置1745 0 -1745所以是...一切都與IE關閉,但希望這一小段代碼將幫助你,或者其他人進一步爲IE做出半兼容的代碼。
我已經找到該代碼,我無法使用它。我的左屏幕是1600x900,我的右屏幕1920x1080。正確的屏幕是我的主屏幕。 'window.leftScreenBoundry()'返回-1920,這超出了我的桌面。 –
也一樣。與監視器的排序等有關。對此你沒有太多的辦法。你試圖達到什麼目標? – Tschallacka
調整窗口大小。我有幾個動態元素,這使我無法讓IE處理窗口大小。 –
- 1. 多朋友選擇器不顯示在Internet Explorer上
- 2. Internet Explorer和Base64圖像顯示
- 3. Bootstrap Internet Explorer顯示本地和遠程
- 4. Internet Explorer問題和背景未顯示
- 5. Internet Explorer 9顯示問題
- 6. Internet Explorer只顯示背景
- 7. Internet Explorer未顯示Flowplayer-Video
- 8. Internet Explorer未顯示元素
- 9. Internet Explorer文本顯示API
- 10. Internet Explorer不顯示圖像
- 11. CSS問題,在Internet Explorer中顯示意外的後臺重複
- 12. 多個Internet Explorer瀏覽器
- 13. Internet Explorer中顯示7/8/9顯示日期時如何禁用Internet Explorer中
- 14. Li在Internet Explorer中未顯示正確
- 15. 勾選框不顯示在Internet Explorer中
- 16. CSS圖像不顯示在Internet Explorer
- 17. 在Internet Explorer中顯示某個頁面
- 18. CSS漸變 - 未在Internet Explorer中顯示
- 19. PHP顯示CSV文件在Internet Explorer
- 20. 在Internet Explorer 9中不顯示Iframe
- 21. 在Internet Explorer中錯誤地顯示
- 22. 在Internet Explorer中未顯示Wordpress圖像
- 23. 此DIV未在Internet Explorer上顯示
- 24. 在Internet Explorer中顯示內聯flex
- 25. pdf文件未顯示在Internet Explorer中
- 26. @ font-face在Internet Explorer上不顯示
- 27. CSS3 Internet Explorer縮放後臺過濾器:
- 28. Internet Explorer和在IFRAME
- 29. 多個Internet Explorer版本瀏覽器測試(Internet Explorer 6-8)?
- 30. 的Internet Explorer 8和Internet Explorer 6並排
哪個版本,我們談論的,最小的支持版本等。 – Tschallacka
IE8(IE11在IE8模式)將是巨大的,但只是IE11將被罰款了。 –