By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,992 Members | 934 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,992 IT Pros & Developers. It's quick & easy.

HTML page loads external frame

P: n/a
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

Jun 20 '06 #1
Share this Question
Share on Google+
14 Replies


P: n/a
Silver wrote:
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

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jun 20 '06 #2

P: n/a
David Dorward wrote on 20 jun 2006 in comp.lang.javascript:
Silver wrote:
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


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.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 20 '06 #3

P: n/a
Evertjan. wrote:
David Dorward wrote on 20 jun 2006 in comp.lang.javascript:
Silver wrote:
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


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.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Jun 20 '06 #4

P: n/a
Jonathan N. Little wrote on 20 jun 2006 in comp.lang.javascript:
============= 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


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?
(iframes included) and I guess
to prevent breaking out of frames a non-javascript solution would be a
rewrite in the .htacess file.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 20 '06 #5

P: n/a
Evertjan. wrote:
No
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.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jun 20 '06 #6

P: n/a
David Dorward wrote on 20 jun 2006 in comp.lang.javascript:
Evertjan. wrote:
No

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.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 20 '06 #7

P: n/a
Silver wrote:

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"

<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)
Jun 20 '06 #8

P: n/a
Evertjan. wrote:
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.


I didn't say it couldn't, just that it is better done server-side.
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?


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

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Jun 20 '06 #9

P: n/a
Jonathan N. Little wrote on 20 jun 2006 in comp.lang.javascript:
Evertjan. wrote:
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.


I didn't say it couldn't, just that it is better done server-side.


You are repeating yourself.
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?


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?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 20 '06 #10

P: n/a
jojo wrote on 20 jun 2006 in comp.lang.javascript:
Silver wrote:

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.

It can also be done by serverside javascript.

<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)


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 20 '06 #11

P: n/a
Evertjan. schrieb:
jojo wrote on 20 jun 2006 in comp.lang.javascript:
Silver wrote:
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...

It can also be done by serverside javascript.

<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)


Jun 20 '06 #12

P: n/a
jojo wrote on 20 jun 2006 in comp.lang.javascript:
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...


Same here but inverted.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 20 '06 #13

P: n/a
Evertjan. wrote:
Jonathan N. Little wrote on 20 jun 2006 in comp.lang.javascript:
Evertjan. wrote:
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. I didn't say it couldn't, just that it is better done server-side.


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

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?


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

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Jun 20 '06 #14

P: n/a
Jonathan N. Little wrote on 20 jun 2006 in comp.lang.javascript:
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.


Roger, oversaw the short named NG.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 21 '06 #15

This discussion thread is closed

Replies have been disabled for this discussion.