Handle HTML5 window resizing better