1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Partial load of website > Iframe

Discussion in 'General Programming Chat' started by 19w08, Apr 2, 2009.

Tags:
  1. 19w08

    19w08 Guest

    Hi Guys,


    When loading a website trough a iframe it causes the statusbar going into overdrive in FF.

    Is there a script that loads the targeted website for an specific amount of time, just to make ' the hit' instead of loading the whole thing?

    Thanks in advance guys
     
  2. drdankmendez

    drdankmendez Junior Member

    Joined:
    May 30, 2008
    Messages:
    194
    Likes Received:
    316
    Location:
    In front of my computer
    You can use javascript to do this. Here is an example page, in the example an iframe is loaded with google.com, after 5 seconds the iframe is removed from the page.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Example Iframe Remover</title>
    </head>
    
    <body>
    	<script type="text/javascript">
    		function clearDiv(divId){
    			document.getElementById(divId).innerHTML = '';
    		}
    		setTimeout("clearDiv('iFrameHolder')", 5000);	
    	</script>	
    	<div id="iFrameHolder">
    		<iframe src="http://www.google.com"></iframe>
    	</div>
    </body>
    </html>
    What is happening here is when the page loads it is loading a DIV tag with an ID of "iFrameHolder", inside this DIV is the iframe calling google. On page load the javascript waits 5 seconds (setTimeout - 5000) then sets the innerHTML (contents) of the DIV to '' (nothing).

    Hope this helps.
     
  3. 19w08

    19w08 Guest

    Hi drdankmendez,


    Dude you nailed it exactly on he spot. I was looking to other options but they all failed.
    Didnt know actually that there was a option like this.

    It works like a charm, and u made my day.

    Rep given, you are a asset to this community.


    TC