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.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Nov 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Displaying content in an Iframe from a different domain

    We are having a problem displaying content in an iframe from another domain. What we want to do is have the iframe resize itself to the height of the displayed content. If the page is too long to display without a scrollbar, we'd like the scrollbar to occur at the page level, not the iframe level. Is there a way to do that? NOTE: We've been able to accomplish this as long as the iframe content is from the same domain as the parent page, but not when the iframe content is from a different domain. There appears to be some issue crossing domains that we have been unable to identify and solve.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Javascript cannot go across domains which is why you can't get it to work. I'm assuming you are trying to read the offsetHeight of the page in the iframe then set the height of the iframe on the parent page to the offsetHeight.

  • #3
    New to the CF scene
    Join Date
    Nov 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You are correct - that is what we've been trying. Is there another way to accomplish this? As a workaround we have been considering trying to set the height of the iframe to some ridiculous number and then use Javascript to always scroll it to the top. Since we would not be depending upon the page size from another domain, would this work?

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    To scroll to the top you would have to access the page in the iframe and again you will get an error because its cross domain. Do you even have permission from the owner if you could put their page on your site?

  • #5
    New to the CF scene
    Join Date
    Nov 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, we have permission - we pay a monthly fee in order to use their services. The service providers have not been able to come up with a solution for this either. The page runs content from 2 different websites inside the iframe based on what the user selects. We've asked both providers for a solution. Other users of their services run the entire pages hosted on their servers. The company that wants this solution does not want to do it that way (not my choice on this one). I've also tried using the <object> tag instead of an iframe - same problem, probably for the same reason. Would it be possible to do this with another scripting language such as Perl or VBScript?
    Last edited by davebeseke; 12-12-2005 at 02:42 PM.


  •  

    Posting Permissions

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