Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-10-27
12
Medium Priority
?
348 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 2000 total points
ID: 40407186
Change to

parent.frames['frameb'].location.href = "http://localhost/frameb.html";
0
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 

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

WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

Question has a verified solution.

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

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.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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…
Suggested Courses

730 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