Solved

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

Posted on 2014-10-27
12
318 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
  • 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

813 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now