HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
how do link into a iframe for a page not in the frame page
Goto page Previous  1, 2, 3  Next
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Frame
View previous topic :: View next topic  
Author Message
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8315
Location: Castle Pines North, CO USA

PostPosted: Wed May 24, 2006 3:13 am     Reply with quote



ariel wrote:
That will open badjuju.org in the 'content' frame on page2?
Yes - that targets the correct frame.
ariel wrote:
How does the link on Page1 know to look for that target frame on Page2?
You told it to in the target
Code:
target="content"
and that is your frame name

_________________
Corey
Loud Info | Loud Worx | Merchant Account Blog
ariel



Joined: 22 May 2006
Posts: 12

PostPosted: Wed May 24, 2006 8:41 am     Reply with quote

That doesn't work. I'm guessing that since no one seems to understand what I'm trying to do that it's not possible.

Let me try this again, with the simplest possible code I can write to illustrate.

External links target page: links.html

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Page Title</title>
</head>

<body>
<table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#4F4F3D">
  <tr>
    <td width="17%"><a href="index.html"><img src="images/tiny_logo.jpg" width="130" height="35"></a></td>
  </tr>
</table>
<!-- Begin Iframe -->
<p><iframe width="100%" height="1200" src="blank.html" name="content"></iframe> </p>
<!-- End Iframe -->
</body>
</html>


Home page, index.html:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Page Title</title>
</head>

<body>
<table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#4F4F3D">
  <tr>
    <td width="17%"><a href="index.html"><img src="images/tiny_logo.jpg" width="130" height="35"></a></td>
  </tr>
</table>
<p><a href="http://www.notmysite.com/" target="links.html_content">A link to a different site</a></p>
</body>
</html>


Now the link in the above page I know isn't how to make this target, but it is the best way I can think of to show what I mean.

index.html does not have an iframe. links.html does have an iframe. When I form a link to another site on index.html, I want that *other site* to appear in the iframe on links.html.

If on index.html I simply do:
Code:
<a href="http://www.notmysite.com/" target="content">External</a>


Then it's going to look for a frame called "content" on index.html, NOT on links.html. Since there is no such frame on index.html, it simply loads www.notmysite.com in a new window, as if I'd used _blank.
drake14



Joined: 29 Jul 2005
Posts: 132
Location: around...

PostPosted: Wed May 24, 2006 9:30 am     Reply with quote

You dont have a page that tells what the frames are...unless im thinking of something else you should have a page that tells what each frame is. Corey knows the code better than i do.

unless im mistaking you should have something like this:

Code:
<!doctype html public "-//W3C//DTD HTML 3.2 Final//EN">
    <html>
    <head>
      <title>Title of this Whole Page</title>
     </head>
   
      <FRAMESET ROWS/COLS="X,Y,...Z">
       <FRAME NAME="framename" SRC="frame_source1.html">
       <FRAME NAME="framename" SRC="frame_source2.html">
           :
           :
       <FRAME SRC="frame_sourceN.html">      
      </frameset>
      <NOFRAMES>
      This is what someone would see who does not have a web
      browser that can display frames.
      </NOFRAMES>
  </html>


Then you can set your frame names so that the links will work properly.
ariel



Joined: 22 May 2006
Posts: 12

PostPosted: Wed May 24, 2006 9:34 am     Reply with quote

I'm not using a frame set.

I have a static page (index.html) and a page with an iframe (links.html)

I want a link on index to open links.html and load that link in links.html's iframe.

No framesets.
drake14



Joined: 29 Jul 2005
Posts: 132
Location: around...

PostPosted: Wed May 24, 2006 9:59 am     Reply with quote

Your code in index.html

Code:
<a href="http://www.notmysite.com/" target="links.html_content">A link to a different site</a>


try replacing it with this:

Code:
<a href="http://www.notmysite.com/" target="links.html">A link to a different site</a>
ariel



Joined: 22 May 2006
Posts: 12

PostPosted: Wed May 24, 2006 10:08 am     Reply with quote

But will it load in the "content" iframe on links.html?
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8315
Location: Castle Pines North, CO USA

PostPosted: Wed May 24, 2006 11:22 am     Reply with quote

ariel wrote:
I'm not using a frame set.
What are you using? You put a question in the Frames section and you need to use a frameset / iframe - your code suggests you are using a frame.
ariel wrote:
I have a static page (index.html) and a page with an iframe (links.html)
So you are using a frame, right?

You have to target your link to your iframe name. You cannot target a web page
Code:
target="links.html"
it has to be the name of the iframe which you named it
Code:
links.html_content


Is this what you want to open in the iframe
Code:
"><a href="index.html"><img src="images/tiny_logo.jpg" width="130" height="35"></a>
If so - add your target

_________________
Corey
Loud Commerce | Loud Worx | Merchant Account Blog
ariel



Joined: 22 May 2006
Posts: 12

PostPosted: Wed May 24, 2006 11:31 am     Reply with quote

I'm just going to assume at this point that it can't be done.

For anyone else reading this:

No, you cannot make a link target an iframe on a seperate page from the one the link is on.

A link on page1.html cannot open page2.html and "load" that link into a frame or iframe on page2.html.
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8315
Location: Castle Pines North, CO USA

PostPosted: Wed May 24, 2006 1:20 pm     Reply with quote

I am trying to recreate what you want to do - but it does not make too much sense.

I put
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Page Title</title>
</head>

<body>
<table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#4F4F3D">
  <tr>
    <td width="17%"><a href="index.html"><img src="images/tiny_logo.jpg" width="130" height="35"></a></td>
  </tr>
</table>
<p><a href="http://www.notmysite.com/" target="links.html_content">A link to a different site</a></p>
</body>
</html>
on this page. Now this is the page that it seems you want to link to - which you do state is not your site. And you want this site to be in an iframe of sorts? I am guessing from the code that you provided
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Page Title</title>
</head>

<body>
<table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#4F4F3D">
  <tr>
    <td width="17%"><a href="index.html"><img src="images/tiny_logo.jpg" width="130" height="35"></a></td>
  </tr>
</table>
<!-- Begin Iframe -->
<p><iframe width="100%" height="1200" src="blank.html" name="content"></iframe> </p>
<!-- End Iframe -->
</body>
</html>
which I did upload to this page. Now is this the page that you want www.notmysite.com to show up in? If so you need to put the www.notmysite.com in the iframe so that you have
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Page Title</title>
</head>

<body>
<table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#4F4F3D">
  <tr>
    <td width="17%"><a href="index.html"><img src="images/tiny_logo.jpg" width="130" height="35"></a></td>
  </tr>
</table>
<!-- Begin Iframe -->
<p><iframe width="100%" height="1200" src="http://www.notmysite.com" name="content"></iframe> </p>
<!-- End Iframe -->
</body>
</html>

_________________
Corey
Loud Info | Loud Worx | Merchant Account Blog
oliver_savage



Joined: 25 May 2006
Posts: 1

PostPosted: Thu May 25, 2006 2:08 am     Reply with quote

I looked into it, there is no way to do this with only HTML.

Another way to state the problem would be:
I need a link that is in the starting page (page1) to open up in another parent page (page2) with the intended link opening in the iframe of that parent page (page2).

What you will do is trigger; by clicking a link, the passing of the iframe "src attribute" (your link) from page1 to page2, both pages need code to know what to expect.

This can be accomplished with javascript, DHTML, SSI, or any webfriendly programming language that your host allows. Iframes weren't always treated well or equally by many browsers. There continue to be issues with scripting approaches to iframe usage. Foremost in my mind is that browser history can get bungled or looped. There are other pitfalls, but the usefulness of iframes; although an imperfect one, does have advantages.

Here is a link that has some javascript, it is shortish, and seems to avoid the browser history issues. It is from 2001, and I haven't tested it.
http://www.webmasterworld.com/forum91/567-2-20.htm

Good luck
cbulmer



Joined: 06 Jun 2006
Posts: 1

PostPosted: Tue Jun 06, 2006 10:29 am     Reply with quote

it knows where to look because when it loads, the iframe is added to the frame heirachy of the browser. This means that any link can be targeted at any frame on a page.
drake14



Joined: 29 Jul 2005
Posts: 132
Location: around...

PostPosted: Wed Jun 07, 2006 3:26 am     Reply with quote

just like we said Very Happy

so just target the frame and it should work.
ariel



Joined: 22 May 2006
Posts: 12

PostPosted: Thu Jun 08, 2006 7:38 am     Reply with quote

No. NOT just like you said. This does not work.

I don't know why you guys don't understand what the problem is.

You can't make a link that loads in a different page's iframe.

You can target an iframe on the current page all you want. This is not the problem.

With the exception of javascript help, all the code you guys have posted targets the iframe on the current page, not the external page like I'm asking.

Forget it guys, I've abandoned the quest.
barthez



Joined: 10 Jan 2007
Posts: 1

PostPosted: Wed Jan 10, 2007 8:27 am     Reply with quote

It is correct that you can't use html to target an iframe within a frameset that's on an other page.
But with javascript you can, here is the correct code for your link that should target the iframe:
Code:

<a href="javascript:parent.frames['frame1'].frame2.location.href='blabla.htm';"></a>

Where frame1 is the frame name from the frameset and frame2 is the frame name from the iframe, ofcourse you can replace blabla.htm with any other link.
beuvema



Joined: 14 Jan 2007
Posts: 1

PostPosted: Sun Jan 14, 2007 11:17 am     Reply with quote

Here's how I solved the problem....

copied the index.html to newpage.html and target the page.html you need.

not exactly what you meant but it gets you there anyway....

Regards
Beuvema
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Frame All times are GMT - 8 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial