Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1625 How can I cause a page to refresh/reload when a user changes the size of the window?

irt.org | Knowledge Base | JavaScript | Window | Q1625 [ previous next ]

Q1625 How can I cause a page to refresh/reload when a user changes the size of the window?

Try the following, the JavaScript1.2 is required:

<script language="JavaScript1.2"><!--
var origWidth, origHeight;

if (document.layers) {
  origWidth = window.innerWidth;
  origHeight = window.innerHeight;
  onresize = function() { if(innerWidth != origWidth || innerHeight != origHeight) location.reload(); }
}

else if (document.all) onresize = function() { window.location.reload(); }
//--></script>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.