Daniel Nardoza

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromDaniel Nardoza
ToMe
Subjectembedding a page in a page and controlling the embedded address
Date4 November 2004 20:32
I have an idea and I'm not sure it's even possible.

I want to embed a web page in a web page, and then be able to select the 
page it displays with links or buttons.
I found code for the embedding:

<OBJECT data=http://www.web-source.net/web_tips_feed.htm width="600" 
height="400">
<EMBED src=http://www.web-source.net/web_tips_feed.htm width="600" 
height="400">
Error: Embedded data could not be displayed. </OBJECT>

Other then the site that I got it from, the only other address I can get 
to work properly are ones I create locally, which is ok because it's my 
content that I ultimately would like to show. For some reason if I put 
an address in there like http://msn.com it doesn’t load properly. Which 
is a problem I would like explained but not ultimately my problem.

Then I used javascript to create buttons on links to change the link inside.
I made a function, and then it sets the address.
I tried it with and if statement, and then a switch. I never got the 
switch statement to work right. But either way, the page reloads and the 
content from the first page disappears and the new page loads with the 
intended link embedded. I lose all the buttons, and other content from 
the first page.

I wish to have the same page viewed, sort of giving you the appearance 
of changing a channel, just the embedded page changing. I want to create 
buttons to set a series of links to pop up.

I realize this could all be done with frames, but that’s what I am 
trying to avoid.
Can this be done and if so how.

Thank you for you time and help,
-dan
FromMe
ToDaniel Nardoza
SubjectRe: embedding a page in a page and controlling the embedded address
Date5 November 2004 8:30
Dan,

Although objects may look like the way to do this, they really aren't. Many
IE installs will not cope with using objects for anything except plugins.

You say you want to avoid using frames, but I will propose a compromise;
the best approach here is to use the iframe element. This is a frame, but
unlike normal frames, it is specifically designed to embed one page inside
the normal flow of another page. This keeps the pages separate, so that
they don't replace each other the way you were describing.

<a href="news1.html" target="newstarget">News item 1</a>
<a href="news2.html" target="newstarget">News item 2</a>
<iframe height="300" width="150" src="initial.html" name="newstarget">
 <a href="initial.html">Some initial info for browsers that do not support
 iframes</a>
</iframe>

You can put alternative content inside the tag (as I have done with the
initial information link) but there really is no need, as the way this is
done, it makes itself accessible. If a browser does not support the ifame
(Netscape 4.x falls into this category), the links will open in a window
instead. Pages can come from any source including external web addresses;
http://www.google.com

If you want a link in the iframe to open in the main page, it must use the
_parent (or _top) target:
<a href="newpage.html" target="_parent">News item 1</a>
Of course, with external pages like Google, this is out of your control
(and scripts from one domain are not allowed to influence pages from other
domains, so you cannot change targets like this using script), but you can
do this with your own pages if you want to.

Hope this provides the solution you were looking for


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.