www.webdeveloper.com
Results 1 to 3 of 3

Thread: Js causes browser to hang

  1. #1
    Join Date
    Feb 2006
    Posts
    66

    Js causes browser to hang

    Hey

    I have a script which uses server pushing effect (COMET)

    But for some reason it hangs the browser and im not entirely sure where the issue lies, firebug doesn't give an error either.

    So was hopeing some one could spot it and help me out!

    Heres basically what i got:

    PHP Code:
        <script type="text/javascript">
        function 
    Chat(divurl) {
            
    this.div div;
            
    this.url url;
            
    this.start = new Date().getTime();

            
    this.start = function(lastupdate) {
                
    lastupdate lastupdate lastupdate : new Date().getTime()
                
    ajaxPost(this.url'lastupdate='lastupdate, function(up) {
                    return function() {
                        if (
    this.readyState == 4) {
                            
    // success
                            
    if(this.status == 200) {
                                var 
    data = eval('(' this.responseText ')');
                            
                                
    // start next timer
                                
    up.start(data.lastupdate);
                            
                                
    // fill chat
                                
    document.getElementById(up.div).innerHTML += data.html;
                                var 
    document.getElementById('chat');
                                
    a.innerHTML onlyNewStuff(4a);
                            }
                            
                            
    // connection error
                            
    else {
                                
    // try again in 8 seconds
                                
    setTimeout(function(){
                                    
    up.start(lastupdate);
                                }, 
    8000);
                            }
                        }
                    };
                }(
    this));
            };
        }
        
        var 
    chat = new Chat('chat''load.php');
        
    </script> 
    Can any one see anything that might cause the hang on my browser?

  2. #2
    Join Date
    Dec 2002
    Location
    St. Louis, MO, USA
    Posts
    1,582
    The only thing I can spot, right now, is using "div" as a variable name - not sure if that's a good idea.

    In addition to FireBug, take a look at the FireFox Error Console, under Tools. That might be getting an error message that FireBug isn't. Just a thought.

    ^_^

  3. #3
    Join Date
    Feb 2006
    Posts
    66
    I guess it must be load.php then =/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles