Forcing page into frame

B

Bernard Davis

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.
 
B

Bernard Davis

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
 
B

Bernard Davis

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
 
M

Mick White

Tom said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top