Solved

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

Posted on 2014-10-27
12
307 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
Comment Utility
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
Comment Utility
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
Comment Utility
Change to

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

Author Comment

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

Expert Comment

by:Gary
Comment Utility
What browser, this works in FF and IE
0
 

Author Comment

by:Ron1959
Comment Utility
I'm testing it in FF.
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:Ron1959
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses four methods for overlaying images in a container on a web page
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 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…

772 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

12 Experts available now in Live!

Get 1:1 Help Now