Fix Netscape "CSS resize bug"Tag(s): HTML/CSS


Netscape has the bad habit to move around element around when you resize a window while IE keep your layout intact. Simply the following code in your page :
// Netscape fix resize bug Ns4
function WM_netscapeCssFix() {
  if (document.WM.WM_netscapeCssFix.initWindowWidth != 
          window.innerWidth ||
        document.WM.WM_netscapeCssFix.initWindowHeight != 
          window.innerHeight) {
     document.location = document.location;
    }
}

function WM_netscapeCssFixCheckIn() {
  if ((navigator.appName == 'Netscape') 
       && (parseInt(navigator.appVersion) == 4)) {
    if (typeof document.WM == 'undefined'){
       document.WM = new Object;
       }
    if (typeof document.WM.WM_scaleFont == 'undefined') {
       document.WM.WM_netscapeCssFix = new Object;
       document.WM.WM_netscapeCssFix.initWindowWidth = window.innerWidth;
       document.WM.WM_netscapeCssFix.initWindowHeight = window.innerHeight;
       }
    window.onresize = WM_netscapeCssFix;
  }
}

WM_netscapeCssFixCheckIn();

// catch all errors...
function stopError() {return true;}
window.onerror=stopError;


blog comments powered by Disqus