Solved

I need jquery to load a url in an iframe on another page

Posted on 2014-10-27
12
326 Views
Last Modified: 2014-10-27
My bottom line question is, can I load a page (url) in one iFrame from a call by another page (url)  in its own iFrame on the same page?   All urls are on the same site.

I have a Main Page with four iFrames, each of which loads other page or urls.

One iFrame contains a Menu Page, which drives a Result Listing Page, and the results are drawn on Map Pages in the 3rd and 4th iFrames.

I need for the Menu Page to load the Results Page in its iFrame, preferably with $(document).ready(function(), then the  Results Page should, likewise, load the other two iFrames with the two Map Pages.

This would be easy if the menu was part of the Main Page, but, again, it is residing in its own iFrame on the Main Page.

Menu (in IFrame) ---> Result Page (in iFrame) --> 2 Map Pages (in two iFrames)

Can this be done?  If so, how?

Thanks!
0
Comment
Question by:Ron1959
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
12 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40407107
Yes

Parent page
<iframe name="framea" src="framea.html"></iframe>
<iframe name="frameb" src=""></iframe>

Open in new window


framea.html
<script>
top.frames['frameb'].location.href = "http://localhost/frameb.html";
</script>

Open in new window

0
 

Author Comment

by:Ron1959
ID: 40407175
Gary,

top.frames is not working for me.   Please keep in mind that all the iFrames are on the same Main Page, one is not nested in the other.

Any other ideas?

Thanks!

- Ron
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40407186
Change to

parent.frames['frameb'].location.href = "http://localhost/frameb.html";
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

Author Comment

by:Ron1959
ID: 40407213
No, that doesn't work for me either....
0
 
LVL 58

Expert Comment

by:Gary
ID: 40407222
What browser, this works in FF and IE
0
 

Author Comment

by:Ron1959
ID: 40407227
I'm testing it in FF.
0
 

Author Comment

by:Ron1959
ID: 40407231
I think your solutions would work if the script was being called from the Main Page, but I need the script to run from within one of the iFrames on the Main Page, and that iFrame is a container for another page.
0
 
LVL 58

Expert Comment

by:Gary
ID: 40407252
And thats what I showed you above - Frame A has the script and that loads whatever page in Frame B
If it's not working then something else is going on that is stopping it.
Can you put up a test page?
0
 

Author Comment

by:Ron1959
ID: 40407329
Here it is: http://www.libertytools.org/LibertyTools/mapping/LibertyMaps.php

The menu is right below the maps.  I want to be able to select some other parameters and click "Set" and refresh the list below the menu first (which queries a 200,000 record mysql database), and then the the list page should reload the maps, since they depend on the query from the list page.

Thanks!
0
 
LVL 58

Expert Comment

by:Gary
ID: 40407339
You have iframe_result_list as the ID of the iframe - you need (as well) the name

name="iframe_result_list"
0
 

Author Comment

by:Ron1959
ID: 40407384
Yes!   I know better than that.   Thanks for pointing out what I was blind to!

I'll accept your answer, above.

Thanks!
0
 

Author Closing Comment

by:Ron1959
ID: 40407389
parent.frames['frameb'].location.href = "http://localhost/frameb.html";   worked exactly as I needed it to.  The only problem I had was my failure to include the name as well as id in the iFrame tag.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question