One step forward two steps back Date: July 10, 2008  Tags: comet , javascript    Comments(0)

The newer versions of Opera Browser run functions twice which added as listener to event-source elements.I found this bug when I test new version of pi.comet .You can find the source code as below:

event-source.html <body> <div id="time"></div> <script> var event = document.createElement("event-source"); event.setAttribute("src","event-source.php"); document.body.appendChild(event); event.addEventListener("azer",function(){ document.getElementById("time").innerHTML += "
"+arguments[0].data; },false); </script> </body>


event-source.php <? header("content-type: application/x-dom-event-stream"); while(true){ print "Event: azer\n"; print "data: ".time()."\n\n"; sleep(3); ob_flush(); flush(); } ?>   


Leave Comment

Name:
E-Mail: (Will be not published)
Website:
 Your comment will be published after confirmation.

BROWSE BY TAGS

 appengine (1)  cherrypy (3)  comet (6)  debugging (1)  django (3)  greasemonkey (1)  javascript (11)  linux (3)  misc (11)  pi (5)  python (3)  security (1)  turbogears (2)  turkce (1)

ARCHIVES

August 2008
July 2008
May 2008
April 2008
March 2008

RECENT WORK

english-turkish translator
firebug lite
YAMLWriter
pi.debugger
gmCeviri
View All

FLICKR

View All

LINKS

Cloudo&Hakan Bilgin
Muhammed Daud
Serdar Meydanci
Ferruh Mavituna
CherryPy
Christian Wyglendowski
the spanner
john resig
eric's weblog
dustin diaz

A Django site.