SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: iframe

  1. #1
    SitePoint Addict manipura's Avatar
    Join Date
    Apr 2001
    Location
    Calgary,AB
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    iframe

    hello all, I'm building a blog for a local festival, and another local online magazine wants to be able to embed this blog on their website. Their idea was to just put it into a simple Iframe. And as a developer passionate about my work, I have to find a better solution. So I'm trying to make the iframe act as though it were part of the page. Although my javascript skills are limited, all I've gotten it to do is resize the frame to fit the first page loaded. How would I go about making it so that every page load, the iframe will resize itself so that it will never show a scrollbar. I want the blog to seem like it's built and running on the magazines site. Any ideas?

  2. #2
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Something like this perhaps? -

    Code JavaScript:
    <script type="text/javascript">
    var iframe = document.createElement("IFRAME");
    iframe.style.position = 'absolute';
    iframe.style.width = '100%';
    iframe.style.height = '100%';
    iframe.style.top = '0';
    iframe.style.left = '0';
    iframe.style.overflow = 'auto';
    iframe.style.zIndex = '999';
    iframe.frameborder = "0";
    iframe.src = "http://www.sitepoint.com";
    document.body.appendChild(iframe);
    </script>

    (Put script above the END body tag - </body>)
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  3. #3
    SitePoint Enthusiast GenePimentel's Avatar
    Join Date
    Apr 2008
    Location
    Oswego, NY
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or, if you can rename your pages to .php, use a php include. It's much easier!

  4. #4
    SitePoint Addict manipura's Avatar
    Join Date
    Apr 2001
    Location
    Calgary,AB
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    php includes will not work... Because when you click on a link it will go directly to the page (the url) instead of loading it into frame. Considering the frame will be inside of a template this is not going to work...


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
  •