HTML page loads external frame

S

Silver

I have a main page that includes one menu and one iFrame.
Depending on the selections made on a menu, a different html page is
loaded inside the iFrame. The menu is just a list of <a href=...>

i.e. The user presses the "first" key on the menu, then the first page
is loaded inside the frame.

Find here a sample for the pages I use.

index.html
==========================================
<html>
<body>
<!-- menu here -->
<iframe src="first.htm"></iframe>
</body>
</html>
==========================================

first.html
==========================================
<p>
Hello world
</p>
==========================================

Here is my question. I want that when someone types in the browser
addressbar the address www.mysite.com/first.html, then instead of
loading just the "first.htm" l file, I want to see the entire
"index.html" page and the "first.html" file loaded inside the iFrame.
Is it possible? How can I do in order to do it?
Thank you much in advance.

Mario Jannelli
www.silverino.com
 
D

David Dorward

Silver said:
Here is my question. I want that when someone types in the browser
addressbar the address www.mysite.com/first.html, then instead of
loading just the "first.htm" l file, I want to see the entire
"index.html" page and the "first.html" file loaded inside the iFrame.
Is it possible?

No
 
E

Evertjan.

David Dorward wrote on 20 jun 2006 in comp.lang.javascript:

Yes [if the diference between .htm and .html is a typo]


============= in first.html =============

<script type='text/javascript'>
if (self == top) location.href='index.html?f=first.html'
</script>

============= in index.html =============

select the f=filename by location.hash and load the iframe.
 
J

Jonathan N. Little

Evertjan. said:
David Dorward wrote on 20 jun 2006 in comp.lang.javascript:

Yes [if the diference between .htm and .html is a typo]


============= in first.html =============

<script type='text/javascript'>
if (self == top) location.href='index.html?f=first.html'
</script>

============= in index.html =============

select the f=filename by location.hash and load the iframe.

Better to do it with server-side and not depend on JavaScript

index.php?f=first.html

It is one of the nasty bit with frames, (iframes included) and I guess
to prevent breaking out of frames a non-javascript solution would be a
rewrite in the .htacess file.
 
D

David Dorward

Yes [if the diference between .htm and .html is a typo]

Oh, misunderstood the question. It isn't trying to capture *any* page the
user tries to visit in the frame.
 
E

Evertjan.

Jonathan N. Little wrote on 20 jun 2006 in comp.lang.javascript:
Better to do it with server-side and not depend on JavaScript

Sure, but it can be done clientside.

index.php?f=first.html

It is one of the nasty bit with frames,

There are no frames to break out if (self == top), not?
 
E

Evertjan.

David Dorward wrote on 20 jun 2006 in comp.lang.javascript:
Yes [if the diference between .htm and .html is a typo]

Oh, misunderstood the question. It isn't trying to capture *any* page the
user tries to visit in the frame.

No harm done, that what's a NG is all about.
 
J

jojo

Evertjan. wrote:
[Yes]
============= in first.html =============

<script type='text/javascript'>
if (self == top) location.href='index.html?f=first.html'
</script>

============= in index.html =============

select the f=filename by location.hash and load the iframe.

For what reason do you need the hash? Its also possible to use SSI (if
available on the Server) and write into "index.html"

<iframe href="<!--#echo var="http_referer"-->"></iframe> (Don't worry
about the tag-looking construction in another Tag, this is just a
SSI-command which is replaced from the server before any browser has to
validate it)
 
J

Jonathan N. Little

Evertjan. said:
Jonathan N. Little wrote on 20 jun 2006 in comp.lang.javascript:

Sure, but it can be done clientside.

I didn't say it couldn't, just that it is better done server-side.
There are no frames to break out if (self == top), not?

Won't work if I have JavaScript disabled....
 
E

Evertjan.

Jonathan N. Little wrote on 20 jun 2006 in comp.lang.javascript:
I didn't say it couldn't, just that it is better done server-side.

You are repeating yourself.
Won't work if I have JavaScript disabled....

That can be said for all clientside code on this NG
and has nothing to do with the surmized nastiness of frames above.

So what is your point?
 
E

Evertjan.

jojo wrote on 20 jun 2006 in comp.lang.javascript:
Evertjan. wrote:
[Yes]
============= in first.html =============

<script type='text/javascript'>
if (self == top) location.href='index.html?f=first.html'
</script>

============= in index.html =============

select the f=filename by location.hash and load the iframe.

For what reason do you need the hash? Its also possible to use SSI (if
available on the Server) and write into "index.html"

Because this NG is about javascript, and perhaps especially clientsided.

It can also be done by serverside javascript.
 
J

jojo

Evertjan. said:
jojo wrote on 20 jun 2006 in comp.lang.javascript:
Silver said:
Here is my question. I want that when someone types in the browser
addressbar the address www.mysite.com/first.html, then instead of
loading just the "first.htm" l file, I want to see the entire
"index.html" page and the "first.html" file loaded inside the iFrame.
Is it possible?
Evertjan. wrote:
[Yes]
============= in first.html =============

<script type='text/javascript'>
if (self == top) location.href='index.html?f=first.html'
</script>

============= in index.html =============

select the f=filename by location.hash and load the iframe.
For what reason do you need the hash? Its also possible to use SSI (if
available on the Server) and write into "index.html"

Because this NG is about javascript, and perhaps especially clientsided.

I'm sorry, I missed that this question is crossposted... I read it at
alt.html which does not only deal with JavaScript...
 
E

Evertjan.

jojo wrote on 20 jun 2006 in comp.lang.javascript:
I'm sorry, I missed that this question is crossposted... I read it at
alt.html which does not only deal with JavaScript...

Same here but inverted.
 
J

Jonathan N. Little

Evertjan. said:
Jonathan N. Little wrote on 20 jun 2006 in comp.lang.javascript:


You are repeating yourself.

Yes I am, your remarks seemed to challenge my assertions that
client-side option is vulnerable to client browser settings where are
server-side is not. Or is your problem a perspective problem, not
realizing this is a cross-posted thread.
That can be said for all clientside code on this NG
and has nothing to do with the surmized nastiness of frames above.

So what is your point?

If you look he has cross-posted to alt.html where I am posting from. The
scope is a little more generalized.
 
E

Evertjan.

Jonathan N. Little wrote on 20 jun 2006 in comp.lang.javascript:
If you look he has cross-posted to alt.html where I am posting from. The
scope is a little more generalized.

Roger, oversaw the short named NG.
 

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

Staff online

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top