Forcing page into frame

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bernard Davis

    Forcing page into frame

    Hi,

    I've been asked to add some pages to an existing web-site that was
    done in frames (two different sets of frames with different navigation
    links).

    I need to ensure that if someone tries to load a page without the
    frameset it will force the frameset to take effect with the correct
    page displayed.

    I've got this code at the top of one of the child pages:

    <script language="Javas cript">

    if (top.location == self.location) {
    top.location = '../../index.htm.htm'
    }
    </script>

    This almost works, it opens the frameset correctly, but it always
    shows the original file that the frameset contains.
    How can I force it to open with the correct page displayed?

    Regards,
    Bernard D.
  • micha

    #2
    Re: Forcing page into frame

    1. you have to transmit the url of the page to be displayed to the
    frameset (using the querystring for example) like
    'frameset.htm?u ri=somepage.htm '

    2. have the frameset figure out if a uri is transmitted, and if yes,
    open it the window you like.

    micha

    Comment

    • Bernard Davis

      #3
      Re: Forcing page into frame

      On 4 May 2005 03:23:40 -0700, "micha" <chotiwallah@we b.de> wrote:
      [color=blue]
      >1. you have to transmit the url of the page to be displayed to the
      >frameset (using the querystring for example) like
      >'frameset.htm? uri=somepage.ht m'
      >
      >2. have the frameset figure out if a uri is transmitted, and if yes,
      >open it the window you like.
      >
      >micha[/color]

      Thanks Micha,

      that gives me a starting point.
      However, how would I then convert the ULR into a text string within
      the frameset?

      I know how to do it in PHP easily enough, but this javascript stuff is
      a bit obscure to me.

      Regards,
      Bernard D

      Comment

      • micha

        #4
        Re: Forcing page into frame

        suppose this is what the url looks like:

        HOST/PATHES/frameset.htm?ur i=somepage.htm

        window.location .search will deliver ?uri=somepage.h tm

        window.location .search.slice(5 ) delivers somepage.htm

        Comment

        • micha

          #5
          Re: Forcing page into frame

          i just read you are familiar with php.

          if you have it available on yor server, there would be a much neater
          solution.

          1. transmit the query string to the frameset as above.

          2. have a php script create the frameset on the fly and code the url
          directly into the html output.

          advantage in my opinion: reduces the amount of javascript

          micha

          Comment

          • Tom Scales

            #6
            Re: Forcing page into frame


            "micha" <chotiwallah@we b.de> wrote in message
            news:1115208987 .940937.283950@ o13g2000cwo.goo glegroups.com.. .[color=blue]
            > suppose this is what the url looks like:
            >
            > HOST/PATHES/frameset.htm?ur i=somepage.htm
            >
            > window.location .search will deliver ?uri=somepage.h tm
            >
            > window.location .search.slice(5 ) delivers somepage.htm
            >[/color]

            That's helpful to me too, but my URL is like:

            HOST/PATHES/frameset.htm?ur i=somepage.htm& a=a&b=b&c=c

            How do I split them up?

            Tom




            Comment

            • kaeli

              #7
              Re: Forcing page into frame

              In article <7leh71dok6ugi5 u60rj5678ri613p iglr5@4ax.com>, Bernard Davis
              <bdavis(deletet his)@castlecs.c o.uk> enlightened us with...[color=blue]
              > that gives me a starting point.
              > However, how would I then convert the ULR into a text string within
              > the frameset?
              >
              > I know how to do it in PHP easily enough, but this javascript stuff is
              > a bit obscure to me.
              >[/color]



              HTH

              --
              --
              ~kaeli~
              Murphy's Law #3020: Quality assurance doesn't.



              Comment

              • Bernard Davis

                #8
                Re: Forcing page into frame

                On 4 May 2005 05:24:33 -0700, "micha" <chotiwallah@we b.de> wrote:
                [color=blue]
                >i just read you are familiar with php.
                >
                >if you have it available on yor server, there would be a much neater
                >solution.
                >
                >1. transmit the query string to the frameset as above.
                >
                >2. have a php script create the frameset on the fly and code the url
                >directly into the html output.
                >
                >advantage in my opinion: reduces the amount of javascript
                >
                >micha[/color]

                Thanks for your help. I've done a quick mock-up in PHP to see how
                easy it is, took two minutes and worked fine, the only problem is of
                course that the parent page now has to be xyz.php rather than xyz.htm.

                I'm not too sure if the client will be happy with this as there are
                hundreds of other pages all refering back to xyz.htm.

                Pity I didn't do the whole site from the beginning.

                Regards,
                Bernard D

                Comment

                • Bernard Davis

                  #9
                  Re: Forcing page into frame

                  On Wed, 4 May 2005 07:26:39 -0500, kaeli <tiny_one@NOSPA M.comcast.net>
                  wrote:
                  [color=blue]
                  >In article <7leh71dok6ugi5 u60rj5678ri613p iglr5@4ax.com>, Bernard Davis
                  ><bdavis(delete this)@castlecs. co.uk> enlightened us with...[color=green]
                  >> that gives me a starting point.
                  >> However, how would I then convert the ULR into a text string within
                  >> the frameset?
                  >>
                  >> I know how to do it in PHP easily enough, but this javascript stuff is
                  >> a bit obscure to me.
                  >>[/color]
                  >
                  >http://www.ipwebdesign.net/kaelisSpa...cFrameset.html
                  >
                  >HTH[/color]

                  Thanks for that. I'll bear it in mind as a 'Plan B'

                  Regards,
                  Bernard D

                  Comment

                  • micha

                    #10
                    Re: Forcing page into frame


                    Bernard Davis deletethis wrote:[color=blue]
                    > On 4 May 2005 05:24:33 -0700, "micha" <chotiwallah@we b.de> wrote:
                    >[color=green]
                    > >i just read you are familiar with php.
                    > >
                    > >if you have it available on yor server, there would be a much neater
                    > >solution.
                    > >
                    > >1. transmit the query string to the frameset as above.
                    > >
                    > >2. have a php script create the frameset on the fly and code the url
                    > >directly into the html output.
                    > >
                    > >advantage in my opinion: reduces the amount of javascript
                    > >
                    > >micha[/color]
                    >
                    > Thanks for your help. I've done a quick mock-up in PHP to see how
                    > easy it is, took two minutes and worked fine, the only problem is of
                    > course that the parent page now has to be xyz.php rather than[/color]
                    xyz.htm.[color=blue]
                    >
                    > I'm not too sure if the client will be happy with this as there are
                    > hundreds of other pages all refering back to xyz.htm.
                    >
                    > Pity I didn't do the whole site from the beginning.
                    >
                    > Regards,
                    > Bernard D[/color]


                    there's tools to search/replace text over many files. i use an editor
                    called proton for that (www.meybohm.de), but i don't know if there's an
                    english version.

                    or use the rewrite engine of the apache server to map any access for
                    frameset.htm to frameset.php

                    micha

                    Comment

                    • Mick White

                      #11
                      Re: Forcing page into frame

                      Tom Scales wrote:[color=blue]
                      > "micha" <chotiwallah@we b.de> wrote in message
                      > news:1115208987 .940937.283950@ o13g2000cwo.goo glegroups.com.. .
                      >[color=green]
                      >>suppose this is what the url looks like:
                      >>
                      >>HOST/PATHES/frameset.htm?ur i=somepage.htm
                      >>
                      >>window.locati on.search will deliver ?uri=somepage.h tm
                      >>
                      >>window.locati on.search.slice (5) delivers somepage.htm
                      >>[/color]
                      >
                      >
                      > That's helpful to me too, but my URL is like:
                      >
                      > HOST/PATHES/frameset.htm?ur i=somepage.htm& a=a&b=b&c=c
                      >
                      > How do I split them up?[/color]

                      location.search .split("&")[0].split("=")[0];
                      for one...
                      Mick

                      Comment

                      Working...