Solved

simple loading gif before iframe load

Posted on 2009-07-15
1
774 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 35

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

685 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