Inner Resize Browser Window

This JavaScript function will resize the inside of a browser window to the dimensions provided.

function innerResizeWindow(innerWidth, innerHeight) {
        if (self.innerWidth) {
                myInnerWidth = self.innerWidth;
                myInnerHeight = self.innerHeight;
        }
        else if (document.documentElement && document.documentElement.clientWidth) {
                myInnerWidth = document.documentElement.clientWidth;
                myInnerHeight = document.documentElement.clientHeight;
        }
        else if (document.body) {
                myInnerWidth = document.body.clientWidth;
                myInnerHeight = document.body.clientHeight;
        }
        else {
                return;
        }
        adjustWidth = innerWidth - myInnerWidth;
        adjustHeight = innerHeight - myInnerHeight;
        window.resizeBy(adjustWidth, adjustHeight);
}
window.onload = innerResizeWindow(800,600);

Post new comment

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <css>, <diff>, <drupal5>, <html>, <javascript>, <php>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • You may use [img:xx] tags to display uploaded files or images inline.
  • Allowed HTML tags: <b> <br> <p> <a> <strong> <cite> <em> <code> <ul> <ol> <li> <dl> <dt> <dd>

More information about formatting options