Results 1 to 6 of 6

Thread: Problem with Iframe...

  1. #1
    Join Date
    May 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Problem with Iframe...

    Hi All,

    I am Using IFrame control in my page to display page in that, but my roblem is when i
    increase the resultion of the machine Iframe dosent increase the Hieght of frame, and leave blank space between frame and window.

    how can i change the size of frame depend on the user's machine resolution.

    any idea can any one give me

    Thanks in advance

    -John

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    It's not really clear what you mean exactly. Could you be more specific? Often, something like that can be dealt with by setting the dimensions of the iframe as percentages. That way, the larger the window, the larger the iframe, ex:

    HTML Code:
    <iframe width="70%" height="50%" . . . ></iframe>
    But to get the height right this way when there is no container other than the window (body of the page), you cannot use a valid URL DOCTYPE for your page. If there is a container other than the body, it must also be set to resize to available height somehow.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    May 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    Thanks for ur reply. i m using below code to resize the frame.


    Code:
    function onResultWindowResize(sName)
    { 
    var adj = 25;
    
    var newWinHeight = window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
    
    document.getElementById(sName).style.height = (newWinHeight-adj) + 'px' 
    
    }
    It is working on my machine if i put the adj value by adjusting.

    but on the user browser due to diffrenet resultion it is changing the frame size.

    is there any other way how to over come this problem.

    how to find the resultion on user machine or x and y coordinate of user browser.

    Thanks
    -john
    Last edited by jscheuer1; 05-30-2008 at 03:03 PM. Reason: format code

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I'm not getting why you would want the x and y cords of the browser window. Those would be the left and top positions of the browser on their screen, and would have no relationship to the browser window's dimensions or the user's resolution.

    The user's resolution is:

    Code:
    screen.width
    by:

    Code:
    screen.height
    But that won't tell you much about the size of their window, you already are doing a fairly good job of finding that (its height, at least). Perhaps, instead of using a fixed value from here:

    Code:
    var adj = 25;
    you could probably get a better result by defining it as a portion of the user's window height here:

    Code:
    document.getElementById(sName).style.height = (newWinHeight-Math.floor(newWinHeight*0.10)) + 'px'
    0.10 would make the 'adjustment' 10% of the window height.

    However, (as always) it would be best to develop a layout that isn't so sensitive to various resolutions and screen sizes.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    May 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks Again.

    I have tried below code:

    document.getElementById(sName).style.height = (newWinHeight-Math.floor(newWinHeight*0.10)) + 'px'

    it now working, Is there any way to find the resolution of the machine so depend on the resolution i can adjust the size of frame.

    Regards,
    John

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The resolution is as I said:

    Quote Originally Posted by jscheuer1 View Post
    The user's resolution is:

    Code:
    screen.width
    by:

    Code:
    screen.height
    But that won't tell you much about the size of their window, you already are doing a fairly good job of finding that (its height, at least).
    Like if you did:

    Code:
    alert (screen.width + ' X ' + screen.height);
    It would give you something like:

    800 X 600

    or:

    1440 X 900 (mine)

    or:

    1024 X 768 (another common one)

    etc.

    But this tells you nothing about the size of the browser window, or about the size of the text being displayed in it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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