471,316 Members | 1,660 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,316 software developers and data experts.

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="Javascript">

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.
Jul 23 '05 #1
10 1659
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.htm'

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

micha

Jul 23 '05 #2
On 4 May 2005 03:23:40 -0700, "micha" <ch*********@web.de> wrote:
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.htm'

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

micha


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
Jul 23 '05 #3
suppose this is what the url looks like:

HOST/PATHES/frameset.htm?uri=somepage.htm

window.location.search will deliver ?uri=somepage.htm

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

Jul 23 '05 #4
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

Jul 23 '05 #5

"micha" <ch*********@web.de> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
suppose this is what the url looks like:

HOST/PATHES/frameset.htm?uri=somepage.htm

window.location.search will deliver ?uri=somepage.htm

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


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

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

How do I split them up?

Tom


Jul 23 '05 #6
In article <7l********************************@4ax.com>, Bernard Davis
<bdavis(deletethis)@castlecs.co.uk> enlightened us with...
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.


http://www.ipwebdesign.net/kaelisSpa...cFrameset.html

HTH

--
--
~kaeli~
Murphy's Law #3020: Quality assurance doesn't.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #7
On 4 May 2005 05:24:33 -0700, "micha" <ch*********@web.de> wrote:
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


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
Jul 23 '05 #8
On Wed, 4 May 2005 07:26:39 -0500, kaeli <ti******@NOSPAM.comcast.net>
wrote:
In article <7l********************************@4ax.com>, Bernard Davis
<bdavis(deletethis)@castlecs.co.uk> enlightened us with...
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.


http://www.ipwebdesign.net/kaelisSpa...cFrameset.html

HTH


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

Regards,
Bernard D
Jul 23 '05 #9

Bernard Davis deletethis wrote:
On 4 May 2005 05:24:33 -0700, "micha" <ch*********@web.de> wrote:
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
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

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

Jul 23 '05 #10
Tom Scales wrote:
"micha" <ch*********@web.de> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
suppose this is what the url looks like:

HOST/PATHES/frameset.htm?uri=somepage.htm

window.location.search will deliver ?uri=somepage.htm

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

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

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

How do I split them up?


location.search.split("&")[0].split("=")[0];
for one...
Mick
Jul 23 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by duane | last post: by
2 posts views Thread by petev | last post: by
1 post views Thread by Bongolation | last post: by
1 post views Thread by Harshal | last post: by
4 posts views Thread by WAZOO | last post: by
1 post views Thread by invinfo | last post: by
42 posts views Thread by smerf | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.