Solved

simple loading gif before iframe load

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Javascript in a user control not working 17 52
Javascript - output csv file 18 18
PHP string issue 5 17
Cordova Camera plugin fails 2 15
Developer tools in browsers have been around for a while, yet they are still heavily underused by developers. Developers still fix html or CSS then refresh page to see effect, or they put alert or debugger in JavaScript and then try again and again …
Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
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)
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now