always open pages in the frame

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Jenny
    Staff Sergeant

    • Dec 2005
    • 45

    always open pages in the frame

    I have one frame on my websit ewhich works great (thank you).

    But, if people type in the URL of one of my pages (as opposed to clicking on a link) it does not appear in the frame.

    I have been experimenting with Javascript to change this, but inserting the below code into the page always makes the frame's start URL open in the frame instead. Any ideas?

    <SCRIPT TYPE="text/javascript">
    <!--
    if (window == top) {
    top.location.replace("FRAMESET PAGE NAME HERE"); } //-->
    </SCRIPT>
  • ez-ez
    Special Status

    • Mar 2006
    • 1329

    #2
    Re: always open pages in the frame

    Hi Jenny.. Can you put the page URL here so we can have a look..?

    If I understand you correctly, you want someone to type in a page URL in the adress bar of their browser where they do not leave the page, but, the IFrame on that page would call the types URL.. is this correct..?

    Comment

    • Jenny
      Staff Sergeant

      • Dec 2005
      • 45

      #3
      Re: always open pages in the frame

      Yes. But, also if they are on google.com or somehwere totally different. Then , they should be able to type in the URL and it should appear within the frame, rather than as a stand alone page.

      The URL is www.chemrefer.com/beta.htmkl - it is still in testing, everything works except don't type anything in the search box.

      Comment

      • Andy128
        Major General

        • Dec 2005
        • 2317

        #4
        Re: always open pages in the frame

        That is the down side of making a web-site using I-Frames as a primary navigation tool.

        One way around this is to make the Header of your web-site on top and the navigation menu horizontal. Then stretch your I-frame all the way across the web-page and place it under the header and Menu (800 width). Now make the links so that they appear in the I-frame. Now each page is independent and can be linked to seperately. When they do this- the main header and menu bar will be gone- but they can link to just that page. That is the trade-off.

        Getting to your main site can be accomplished by putting a "Return to Main Page" link on every page at the bottom.

        Hope that helps some.

        Andy
        PHP- is a blast!

        Comment

        • ez-ez
          Special Status

          • Mar 2006
          • 1329

          #5
          Re: always open pages in the frame

          Originally posted by Jenny
          Yes. But, also if they are on google.com or somehwere totally different. Then , they should be able to type in the URL and it should appear within the frame, rather than as a stand alone page.

          The URL is www.chemrefer.com/beta.htmkl - it is still in testing, everything works except don't type anything in the search box.
          The answer you got from Andy above sums up the situation so accurately.. The solution he suggests is the most practical..

          The reason why your pages are not appearing I-Frame is simply because the I-Frame is not a component of those pages... Rather. it is a component of the page preceeding them, ie, Index page.. The problem as I see it is as follows:

          You need to be able to inorporate a command telling the visitor's browsers to display the page in I-Frame, more importantly, not just any I-Frame, but the I-Frame that is located at a particular page, ie, the Index page.

          This is possible, however, this would be a complicated script to write. If the URL was typed into a form which you have control of, it would be easy to have a PHP do this for you, however, you cannot direct another person's browser to a 'processing file' to display your pages in a certain style.. We now have to search for a way to achieve 2 things:

          1. A script that take any URL address to the index page.
          2. take the URL entered by the visitor and call that page into the URL.

          Perhaps, this is possible, but I have a feeling it will involve a lot of hard work and research.

          The above are only suggestions and you can start your search along these lines.

          Comment

          • Jenny
            Staff Sergeant

            • Dec 2005
            • 45

            #6
            Re: always open pages in the frame

            I see. Thanks for your insights.

            The reason I ask was because I read this article which i shwere I got the code I mentioned: http://searchenginewatch.com/showPage.html?page=2167901

            Comment

            • Jenny
              Staff Sergeant

              • Dec 2005
              • 45

              #7
              Re: always open pages in the frame

              OK, I know how to do it now.

              On the parent page I put my i-frame in with this code:

              <script language="javascript">
              // writes in the iframe
              contPage = (location.search.substring(1))? location.search.substring(1) : 'about.html';
              contPage = unescape(contPage);
              document.write('<iframe src="'+contPage+'" name="searchresultsframe" height="1221" width="670" scrolling="no" frameborder="0">');
              document.write('</iframe>');
              </script>

              Then on the 'orphan' pages which I want to only ever open in the i-frame I put this code between the head tags:

              <script>
              pageLoc = self.location; pageAdd = top.location; if (pageLoc == pageAdd) { contentSrc = escape(pageLoc); contPage = 'index.html?' + contentSrc; top.location.href = contPage; }
              </script>


              Comment

              Working...
              X