Browser window: Specifying the size and location?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • asearle
    New Member
    • Sep 2006
    • 39

    Browser window: Specifying the size and location?

    Hi Everyone,

    Does anyone know how I can dictate what size and location the browser window should have when opened?

    I have a lot of fixed-width columns and so it would be great if I could do this so that the user then doesn't need to re-size the window to see the data.

    Many thanks,
    Alan Searle

    PS: This is for IE6 sp1 but I'd be interested in the syntax for Firefox too.
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    This can only be done with javascript. The code will be the same. Firefox follows the standard and I assume IE would do the same.

    Comment

    • asearle
      New Member
      • Sep 2006
      • 39

      #3
      Excellent, yes, javascript has the syntax ...

      [CODE=javascript]window.resizeTo (500,300)[/CODE]

      ... and my application already uses javascript which helps.

      Now I would like to incorporate this in the simplest way possible and so have been googling with the keyword: 'onopen' in the hope that I can just put the command in at the start and the window will resize.

      However, most of the examples that I have found are extremely complicated and so I am still not sure how I can activate this in a simple way so that the window is resized once (when first opened) and then this command is not called again.

      Any tips or links would be a great help.

      Many thanks,
      Alan Searle

      PS: And thanks to the forum staff for moving my posting to the correct location (i.e. Javascript rather than HTML)
      Last edited by gits; Oct 10 '07, 03:09 PM. Reason: added code tags

      Comment

      • asearle
        New Member
        • Sep 2006
        • 39

        #4
        I have incorporated the following along with my other Javascript functions ...

        [CODE=javascript]function onopen()
        {
        window.resizeTo (500,300)
        }[/CODE]

        ... but, although everything else seems to work fine, the window fails to resize.

        I hope/believe that this is just a syntax issue and that someone can point me in the right direction to 'pick up' the 'OnOpen' (or equivalent) event.

        Many thanks,
        Alan Searle
        Last edited by gits; Oct 10 '07, 03:09 PM. Reason: added code tags

        Comment

        • gits
          Recognized Expert Moderator Expert
          • May 2007
          • 5388

          #5
          hi ...

          use the document's onload event for that

          [HTML]<body onload="onopen( );">
          [/HTML]
          kind regards

          Comment

          Working...