Results 1 to 5 of 5

Thread: IFRAME question

  1. #1
    3 Star Lounger
    Join Date
    Jan 2002
    Location
    CT
    Posts
    329
    Thanks
    0
    Thanked 1 Time in 1 Post

    IFRAME question

    I use Iframe on a few websites. As long as the referenced file is in the same directory as the html file calling for the Iframe referenced file everything works fine.

    Today I've created a subfolder to the root directory on one of the websites. The file with the Iframe command is in the subfolder while the file the Iframe it is calling up is in the root directory. As a result I get an error message the the file cannot be found.

    Is there a different command than <iframe...........> that will allow me to call up the file from the root directory into the file in the subfolder?

    Here is what I am using now:

    <iframe src="page_links_top.htm" frameborder="0"
    height="auto" scrolling="no" width="100%"></iframe>

    Where page_links_top.htm is in the root directory.

    You can see the error message at:

    http://www.thompsonconservation.org/...main_page.html

    Any help would be greatly appreciated. I'm not a professional and just do this for my own business site and a few friends and town volunteer organization.

    Thanks,
    BH

  2. #2
    2 Star Lounger
    Join Date
    Dec 2009
    Location
    Northern California
    Posts
    191
    Thanks
    8
    Thanked 43 Times in 37 Posts
    Since it's in the root directory, try changing it to this:

    <iframe src="/page_links_top.htm" frameborder="0"
    height="auto" scrolling="no" width="100%"></iframe>

    Similarly, if it was in one of the other subdirectories you would use "/projects/page_links_top.htm" or "/projects/cemeteries/page_links_top.htm"

  3. #3
    3 Star Lounger
    Join Date
    Jan 2002
    Location
    CT
    Posts
    329
    Thanks
    0
    Thanked 1 Time in 1 Post
    Thanks DG1261. That did the trick. I'd tried similar things but not that exactly. Much appreciated.
    BH

  4. #4
    2 Star Lounger
    Join Date
    Dec 2009
    Location
    Northern California
    Posts
    191
    Thanks
    8
    Thanked 43 Times in 37 Posts
    Glad to hear you got your problem solved.

    Having taken a quick look at your site, I wonder if you might appreciate a suggestion or two.

    As you've evidently discovered, one problem with using iframes is your menu links have to target a different tab or window to prevent the link from undesirably opening the target inside the iframe. You've solved that problem by including target="_blank" in all your <A> tags.

    However, target="_blank" always opens up a new tab, so as you click each menu link you end up with several open tabs. I suppose multiple tabs is not always a bad thing--some designers may even prefer to have each page ("Agendas", "Minutes", etc.) have its own tab. But by using "_blank" as your target it always opens another new tab, even if that particular tab is already open. For instance, click "Agendas" multiple times and you end up with lots of duplicate Agendas tabs.

    To avoid opening up duplicate tabs, use a specific target instead of "_blank". For example:
    <A target="meetings" HREF="meetings.htm"> Meetings </A>
    <A target="agendas" HREF="agendas.htm"> Agendas </A>
    <A target="minutes" HREF="minutes.htm"> Minutes </A>
    This code will open up at most three tabs, one for each page. Every subsequent click of "Agendas", for instance, will go back to the already open Agendas tab instead of opening a duplicate Agendas tab.

    An even better alternative would be to ditch the iframes altogether and instead use Server-Side Includes (SSI). The concept is similar and no more difficult than iframes. I'd be willing to bet your webhost already supports SSI so all you might need to do is lightly reedit your existing files a bit. For a live illustration, take a look at this page I designed for a local soccer organization. All of those menus, as well as the top banner and page footer, are small SSI files that are repeated on each page. For instance, even though "Site Index" displays on every page there is only a single file on the website with the contents of that menu--the same idea for which you're using iframes.


    Dan

  5. The Following User Says Thank You to dg1261 For This Useful Post:

    IreneLinda (2013-10-17)

  6. #5
    3 Star Lounger
    Join Date
    Jan 2002
    Location
    CT
    Posts
    329
    Thanks
    0
    Thanked 1 Time in 1 Post
    Thanks Dan. I'll give SSI a try.
    BH

Posting Permissions

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