Forum Moderators: open

Message Too Old, No Replies

link on different site launch page inside iframe?

can this be done?

         

and the next day

11:32 am on Jun 1, 2006 (gmt 0)

10+ Year Member



can i have an image link on a completely different site launch a page inside of one specific iframe (of 2) on another parent site. if so what would the link look like?

tedster

4:37 pm on Jun 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's no way I know of to do this with straight html and an existing page that loads something different in the iframe as a default.

I can think of two approaches. For one, you would build a copy of the iframe's parent page with the src= attribute set to the document you want to display inside.

The second you would be able to use for many different types of links -- but it also requires javascript. Since an iframe is a "kind of" frame, the logic in this script would work, except you need to adapt it slightly for iframe instead of a frame.

See message #21 (Force Many Pages Into Frames) of this thread:
[webmasterworld.com...]

The idea would be to link directly to the doaument you want to see in the iframe, and then let the script "force" that page into an iframe in the parent page. Note, this approach also requires one copy of the parent page to be created that holds the script.

and the next day

6:05 am on Jun 2, 2006 (gmt 0)

10+ Year Member



hey tedster ive tried the second method because it is what im looking for as i will have to be adding links to these pages on a weekly basis. but im unsure how to go about adapting the code to named iframes. i ready don't know java at all. i just fumble through it.

you said this goes in the head of the child. do i give it <script> tags and only put IT in there or does it go in with the other head tag you said to put in the parent.

passpage = document.URL
if (top.location == self.location)
top.location.href="master.html?" + passpage

```````````````````````

and should this look like

top.location.href="parentpage.html?childpage.html" + passpage

or do i use the full url.

top.location.href="parentpage.html?http://website.com/childpage.html" + passpage

```````````````````````

then what do i do with this. it goes in the parents head but all the frame tags should be iframe and then which ones get named the specific iframe name. i have two in the parent.

<script language="JavaScript" type="text/javascript">

origURL = parent.document.URL
contentURL = origURL.substring(origURL.indexOf('?')+1, origURL.length)

document.write('<frameset cols="20%,80%"><frame src="leftnav.html" name="nav"><frame src=\"' + contentURL + '\" name="content"><\/frameset>')

</script>

just dropping that script into the parent page and renaming frames to iframe contorted the page so something else is off too. does this tag <cols="20%,80%"> do anything to the size or positioning of the iframes. i should probably remove anything regarding size and position if its in there

``````````````````````````

by the way if this is too much to ask for, to have you explain all of this to me, then its ok i can just build separate parents for each child and link to them. ill survive. but it would be very very cool if you could help me out.

steven