Solved

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

Posted on 2014-10-27
12
333 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

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

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 i…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

623 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