Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to set the dimensions and coordinate of a window

    Hello

    I would like to force the initial location of a window to the (0,0) coordinate and give it a specific width and height when it loads.

    I use the following:
    Code:
    function initPage() {
       window.moveTo(0, 0);
       window.resizeTo(400, 400);
    }
    I call this function at the onload event of the page body.
    I get an error saying: "Access is denied"

    what is the problem with the code? what could be causing this?
    thanks

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    What browser are you using? Some browsers such as Firefox allows the user to control the usage of javascript to move or resize existing windows.
    Attached Thumbnails Attached Thumbnails how to set the dimensions and coordinate of a window-jsoptions.jpg  
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New Coder
    Join Date
    Mar 2004
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am using IE6

  • #4
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <script>
    <!--

    function initPage() {
    window.moveTo(0,0);
    window.resizeTo(400,400);
    }
    window.onload=initPage;

    //-->
    </script>

    You are putting this script in the parent window? It works, as expected, in IE 5.0, as well as, NN4.06, although, in NN you will get a window viewing area of 400x400, whereas in IE the window width/height is 400x400.


    -james
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Maybe the error is in the other codes. Could you post a link or attach the related codes?
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #6
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Same ok with the code for me either. Works with IE6, Moz Firefox, Moz 1.7, NS6, NS7 on XP, Home edition

    It does not work on Opera 7.5 but no error is displayed on it's console
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #7
    New Coder
    Join Date
    Mar 2004
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts
    when I changed the line from
    Code:
    <body onload="initPage();">
    to
    Code:
    window.onload=initPage;
    It started working...
    thanks

  • #8
    New Coder
    Join Date
    Mar 2004
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think I know what the problem is (yes, the problem still exists).
    My page contains several IFrames.
    Maybe there is a problem in moving or resizing the page if one of the iframes didn't finish loading yet...
    Is this relevant?
    What doe the "Access denied" error mean?

    How can I solve it?
    When using regular frames, I know that I can count on the onload attribute of the frameset. Is there a similar solution for iframes?

  • #9
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    "Access denied" usually means you're accessing a window/frame/iframe that contains a page in different domain.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #10
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    "Access denied" usually means you're accessing a window/frame/iframe that contains a page in different domain


    That's all I can think of...do you have someone else's domain loaded into the iframe/window?





    -james
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "

  • #11
    New Coder
    Join Date
    Mar 2004
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts
    no I don't
    The site I am working on is still in development and all the files I am using are local on my machine.

  • #12
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I thought this question was answered hours ago over here.....

  • #13
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I thought this question was answered hours ago over here.....


    ha ha...


    I get an error saying: "Access is denied"

    I don't know, that's the only circumstance under which I've seen that error...



    -james
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "

  • #14
    New Coder
    Join Date
    Mar 2004
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here is a simpel html code that reproduces the same bug.
    I would appreciate if someone could point me to the silly error that I am missing:
    Code:
    <html>
      <head>
       <script type="text/javascript">
    	<!--		
    	function initPage() {
    		window.moveTo(0, 0);
    		window.resizeTo(400, 300);
    	}
    	// -->
       </script>
      </head>  
      <body onload="initPage()">
        test
      </body>
    </html>
    I am getting Access denied error on this page when I go to it via Apache. When I go there directly via the browser's "open page" menu, then it works fine.

  • #15
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Works fine for me in IE6 (with SP1;Q832894 patches) and even in Firefox. Must be your IE.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •