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


can iframe be selected from parent window url?

Posted on 2011-02-16
Medium Priority
Last Modified: 2012-05-11
Is there any way for a single url to select both a parent page and the src value (url) of a page to appear within iframe tags in the parent page?
Question by:Jonathan Greenberg
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
  • 3
  • 2
LVL 75

Accepted Solution

Michel Plungjan earned 2000 total points
ID: 34908929

<a  href="">Load index and iframe</a>

This will load the page iframe_page.html into the iframe called iframe1 when the page is loaded from the link
var loc =;
if (loc) loc = loc.split("&");
window.onload=function() {
  if (loc) {
    var iframeName=loc[0].split("=")[1];
    var page=loc[1].split("=")[1];
<iframe name="iframe1" src="about:blank"></iframe>

Open in new window


Author Comment

by:Jonathan Greenberg
ID: 34909302

I'm assuming your code is index.html in your example. I've copied and pasted your code, and I've reproduced your exact example, but all I get is the parent page with an empty iframe.

Author Comment

by:Jonathan Greenberg
ID: 34909405
No, I'm sorry, my mistake! It works perfectly. Thanks!

Author Closing Comment

by:Jonathan Greenberg
ID: 34909488
Thanks for the great answer.
LVL 75

Expert Comment

by:Michel Plungjan
ID: 34909546
YW :)

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction and Prerequisites This article describes methods for detecting whether a client browser accepts and returns HTTP cookies and whether the client browser runs JavaScript.  Most client browsers will, by default, be configured to use cooki…
Introduction This article is intended for those who are new to PHP error handling (  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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

721 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