[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

jquery display iframe src

Posted on 2011-03-02
2
Medium Priority
?
975 Views
Last Modified: 2012-06-21
Hello Experts,

I have an iframe whose src changes.

ie
<a href="#" onClick="$('#login').show();">Show login</a>
<iframe id="login" src="login.php" width="500" height="200" />

Although it starts of as login.php - the user (in the login screen) may decide to load up forgot-password.php or new-user.php (to create a new account).  They load either of these screens by clicking on a link inside login.php. This action refreshs the 'screen' inside the iframe with the correct php page.  

I want to call a piece of code (using jQuery) that will tell me the name of this screen.
I would have thought when the user clicks into the forgot password/new user page - it would in turn change the 'src' tag from login.php to whatever the current screen in the iframe is - however, I'm not sure.  

Is this possible to achieve?
0
Comment
Question by:jagku
[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
2 Comments
 
LVL 6

Accepted Solution

by:
hexer4u earned 2000 total points
ID: 35016696
Yes.
jQuery(function(){
		jQuery('iframe').load(function(){//each time this is called, the frame reloaded
			var current_src = jQuery(this).attr('src');
			var current_body = $('#iframeID').contents().find('body');
			alert(current_body.html());//shows the HTML code inside the <body></body>
		});
	});

Open in new window

0
 

Author Closing Comment

by:jagku
ID: 35028212
Many Thanks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

656 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