diff --git a/app/ui.js b/app/ui.js
index 29bfbd6e3a860f9c930462104c0174e28428f97c..98bb5f63f09ed9e4c0283e4d3669f2d0a4609fa8 100644
--- a/app/ui.js
+++ b/app/ui.js
@@ -1260,7 +1260,16 @@ var UI;
         // Gets the the size of the available viewport in the browser window
         screenSize: function() {
             var screen = document.getElementById('noVNC_screen');
-            return {w: screen.offsetWidth, h: screen.offsetHeight};
+            var width, height;
+
+            screen.style.overflow = "hidden";
+
+            width = screen.offsetWidth;
+            height = screen.offsetHeight;
+
+            screen.style.overflow = "auto";
+
+            return {w: width, h: height};
         },
 
         // Normally we only apply the current resize mode after a window resize