Solved

simple loading gif before iframe load

Posted on 2009-07-15
1
772 Views
Last Modified: 2012-06-27
i have a page with iframe included to load the page. some time the iframe page takes time to load. How do I place loading gif till the page loads it completely. it is html page.

Is there simple div or javascript code to do that? i don't prefer ajax.
0
Comment
Question by:Loganathan Natarajan
1 Comment
 
LVL 34

Accepted Solution

by:
gr8gonzo earned 125 total points
ID: 24862380
In the parent document, create a div that contains your loading message / icon, like this:

<div id="divLoading">Loading...</div>
.....
<iframe src="/your/iframe.php"></iframe>

Then, in your iframe.php file, add some Javascript that looks like:

<script type="text/javascript">
function hideLoadingDiv() {
parent.getElementById("divLoading").style.display = "none";
}
window.onload = hideLoadingDiv;
</script>
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo‚Ķ
This article discusses four methods for overlaying images in a container on a web page
This video teaches users how to migrate an existing Wordpress website to a new domain.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

785 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