Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-13-2013, 07:53 PM   PM User | #1
danllinehan
New Coder

 
Join Date: Mar 2012
Posts: 19
Thanks: 2
Thanked 0 Times in 0 Posts
danllinehan is an unknown quantity at this point
Link to parent containing iframe containing external content?

eeeek.

ok, i need to create a link that opens a parent page that contains an iframe that contains external page content.

i have googled my fingers off, and can't find just what i'm looking for...

in my example:

www.mysite.com/essays.html hosts only an iframe containing content from blogger. the blog has multiple entries, each one with a unique address. we'll say that the individual blogger post addresses are me.blogger.com/post1.html, me.blogger.com/post2.html, etc.

currently, entering the address www.mysite.com/essays.html loads iframe content me.blogger.com/index.html.

i need to create a link from www.mysite.com/music.html that will open www.mysite.com/essays.html and contains the iframe content me.blogger.com/post3.html

is this possible???
danllinehan is offline   Reply With Quote
Old 02-13-2013, 09:42 PM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,454
Thanks: 0
Thanked 498 Times in 490 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Pass the me.blogger.com pagename in the querystring on the end of the essays.html link and update the essays.html page so that if a querystring is supplied then it loads the specified page into the iframe instead of index.html.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 02-13-2013, 09:44 PM   PM User | #3
danllinehan
New Coder

 
Join Date: Mar 2012
Posts: 19
Thanks: 2
Thanked 0 Times in 0 Posts
danllinehan is an unknown quantity at this point
whoa. i really have no idea what you just said (i should have told you all that i'm not very advanced in this type of stuff)...
danllinehan is offline   Reply With Quote
Old 02-14-2013, 04:19 AM   PM User | #4
payling
New to the CF scene

 
Join Date: Feb 2013
Location: NY
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
payling is an unknown quantity at this point
First off, what your trying to do sounds overly complex, is there a reason why music.html can't have an iframe to posts3.html?

What are you trying to accomplish by having the user go from music.html to essays.html then load the iframe from there?

If you insist...
An alternative to felgall solution is to have multiple iframes on essays.html. You could have an iframe for each post. For instance...

<a name="post1"></a>
Post 1
[iframe for post 1]

<a name="post3"></a>
Post 3
[iframe for post 3]

So.... your link from music.html would be an anchor tag to essays.html#post3

When the user from music.html clicks that link he'll go to essays.html and pop down to post3 iframe...

May suite your needs...
payling is offline   Reply With Quote
Old 02-14-2013, 05:21 AM   PM User | #5
danllinehan
New Coder

 
Join Date: Mar 2012
Posts: 19
Thanks: 2
Thanked 0 Times in 0 Posts
danllinehan is an unknown quantity at this point
oh - i guess i didn't explain it correctly.

there is only one iframe on essays.html

in that iframe is a blogger page (blogger/index.html). on blogger/index.html is a table of contents, each headline linking to a page with its own blogger address. so, i'd like to be able to click a link on music.html and go to essays.html, with (for example) blogger/post3.html loaded in that one (and only) iframe on essays.html.
danllinehan is offline   Reply With Quote
Old 02-14-2013, 06:38 PM   PM User | #6
payling
New to the CF scene

 
Join Date: Feb 2013
Location: NY
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
payling is an unknown quantity at this point
I've suggested adding a iFrame for each post..., this of course is not scalable... so that is why I've thought of another - better solution using HASH tags that requires very little code.

essays.html
Code:
<div id="iframe"></div>

<script>
    var post_page_name = location.hash; 

    document.getElementById('iframe').innerHTML = '<iframe src="http://blogsite.com/'+ post_page_name +'.html"></iframe>'; 
</script>
Let me explain the code...

music.html will have a link to essays.html, a hash tag will contain the name of the post you wish to load. So....

Code:
http://mysite.com/essays.html#post1
Once essays.html page loads, the location.hash code parses the current URL for the hash tag...

The iframe is then inserted into the webpage and the iframe loads up the correct post based on the hash tag.

PS.

This method could be extended for different sites by adding more to the hash parameters.... Consider

http://mysite.com/essays.html#blogsite=post1
or ....
http://mysite.com/essays.html#someotherblogsite=post1

You'll need to a little extra parses using split there but it can be done.
payling is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:52 AM.


Advertisement
Log in to turn off these ads.