Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
iframe load status finderh
Old 08-07-2007, 02:37 PM iframe load status finderh
Novice Talker

Posts: 6
Trades: 0
hello
i have an iframe in my homepage.

if there any function in javascript to findout if the iframe has not loaded and if not loaded load another src.
uniaxaj is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-07-2007, 04:14 PM Re: iframe load status finderh
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
This can only be achieved if the iframe have it's url on the same domain that your main page.
IE: the main page url is http://www.whatever.com/index.html
If the iframe points to something else than http://www.whatever.com/..., you will not be able to detect the loading.

Then, for the fun part, in your main page:
HTML Code:
<script type="text/javascript">
function iframeLoaded(){
  alert('the iframe is loaded');
}
</script>
<iframe id="ifSub" name="ifSub" src="http://www.whatever/iframe.html" onload="javascript:iframeLoaded();"></iframe>
Just 1 note: every time the iframe will load a page, the event onload will trigger, meaning that it won't be only on the initial load.
If you want to avoid that, use a counter value to restrict the effect to the first call.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to iframe load status finderh
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13281 seconds with 12 queries