Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-12-2009, 01:01 PM   PM User | #1
Lleoun
New Coder

 
Join Date: Feb 2008
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Lleoun is an unknown quantity at this point
Ajax autorefresh not working with Internet Explorer 6

Hi all,

The code below refreshes mypage.php every 3 seconds without blinking or anything you can notice when seeing the page.
This is working for all browsers except for Internet Explorer 6. When using IE6 the text in mypage.php does not move but the images blink with every refresh.
Here's the page:
http://vivocom.es/test/prensa/index_autorefresh.html

Any ajax genius can modify the script so it can work also for Internet Explorer 6? or even make a new script for Internet Explorer 6 ( I'll detect the browser and I'll show one or the other)..

Thanks a ton in advance!

Code:
<script type="text/javascript">
function getHTTPObject() {
 
 var request = false;
        try {
            request = new ActiveXObject('Msxml2.XMLHTTP');
        }
        catch (err2) {
            try {
                request = new ActiveXObject('Microsoft.XMLHTTP');
            }
            catch (err3) {
                                try {
                                request = new XMLHttpRequest();
                                }
                                catch (err1) 
                                {
                                request = false;
                                }
            }
        }
    return request;
 
}
 
var ajaxRequest = getHTTPObject(); // creating HTTP Object
 
setInterval(getPage, 3000); // 3 secs
function getPage() {
 
            
//    ajaxRequest.open("GET", "mypage.php", true);
            ajaxRequest.open("GET", "mypage.php"+"?dummy="+new Date().getTime(), true)
                ajaxRequest.onreadystatechange = showPage;
               ajaxRequest.send(null); 
   
                
}
                        
function showPage()
{
                if(ajaxRequest.readyState == 4){

                  var ajaxDisplay = document.getElementById('show');
                  ajaxDisplay.innerHTML = ajaxRequest.responseText;

                                
                }                                               
}
window.onload=function(){
        getPage(); 
}
</script>

</head>
<body>

<div id="show" ></div>
mypage.php

Code:
<?php
echo"Here a text that don't blink but the image below does it (when using IE6) every 3 seconds 
<br><br><img src='http://dertompson.com/wp-content/uploads/2008/03/memory-verlauf-ie-reload.png'>";
?>
Lleoun is offline   Reply With Quote
Old 06-13-2009, 01:04 PM   PM User | #2
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
I do not understand your problem "the text will not move". Is it not getting the new data? What does that mean?

Eric
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 08:18 AM.


Advertisement
Log in to turn off these ads.