1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

.innerHTML Internet Explorer won't display html

Discussion in 'JavaScript' started by jestep, Apr 25, 2006.

  1. #1
    Here's the problem.

    I have a simple Ajax script and I need to get the script to display any returned data (html data) as html. Firefox has no problem with it, but IE only display's text.

    Here's what the script returns:
    
    function handleHttpResponse() {
    
     if (http.readyState == 4) {
    
      results = http.responseText;
    
    	if (document.getElementById){
    		document.getElementById('text').innerHTML = results;
    	} else if (document.all) {
    		document.all("text").innerHTML = results;
    	} else if (document.layers){
        	document.layers['text'].document.open();
        	document.layers['text'].document.write(results);
         	document.layers['text'].document.close();
         	document.layers['text'].visibility = 'show';
    	}
    }
    }
    
    Code (markup):
     
    jestep, Apr 25, 2006 IP
    exam likes this.
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Ok, I got my Internet Explorer to work sort of. I had to completely close my current window to get it to work. Does internet explorer do javascript caching or something else that would keep the script showing the same content?

    Is there a way to reset the whole process every time the script is processed?
     
    jestep, Apr 25, 2006 IP
  3. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Make sure your backend script is sending no-cache headers. In Php you can add one or all of:
    
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 
    header("Cache-Control: no-store, no-cache, must-revalidate"); 
    header("Cache-Control: post-check=0, pre-check=0", false); 
    header("Pragma: no-cache"); 
    PHP:
     
    exam, Apr 25, 2006 IP
    jestep likes this.