HTML5 WebSockets makes it possible to open a persistent connection to a server within a web-browser via javascript.
July 11, 2010
July 9, 2010
SproutCore Erfinder eröffnet HTML5-Firma
Der SproutCore Erfinder Charles Jolley verlässt Apple und gründet ein Unternehmen das sich mit der Entwicklung neuer Rich-Web Applikationen auf HTML5-basis beschäftigen wird.
May 26, 2010
Analytics Site Search Tracking
Selbst wenn man keine klassische Volltext-Suche auf der Seite hat kann man mit dem Site Search Tracking von Analytics arbeiten.
February 2, 2010
Browser-History mit jQuery auslesen
Eine wirklich simple Idee … mittels der Farbunterscheidung zwischen “visited”- bzw. “nicht visited”-Links kann man die Browser-History eines Benutzers stehlen. Man braucht allerdings eine Linkliste die man vergleichen kann, also ist es kein richtiges stehlen. Im Detail funktioniert es so das man mittels Javascript Links erzeugt und vergleicht in welcher Farbe sie dargestellt werden. So kann man zB feststellen ob der Benutzer vorher schon bei den Konkurrenten vorbeigeschaut hat.
Mein Beispiel-Script kann man unter folgender Adresse finden:
http://bohuco.net/dev/history/
(via dicabrio)
November 7, 2009
Google Closure Compiler with PHP
Today Google released their new Closure Compiler, you can use it to optimize and minify your javascripts.
July 14, 2009
iPhone Lagesensor via Javascript
Über den Lagesensor kann man ermitteln ob das iPhone gerade hochkant oder horizontal gehalten wird. Safari am iPhone besitzt dazu ein spezielles window-attribut. In window.orientation steht entweder 0 (für vertikal) oder +/-90 wenn das iPhone quer gehalten wird, je nachdem welche Richtung es gedreht wurde.
Um auf eine Änderung reagieren zu können gibt es den Event-Handler onorientationchange den man zum Beispiel im BODY-Tag verwenden kann:
<body onorientationchange="alert(window.orientation);"></body>June 27, 2009
Chrome Javascript Debugger/Profiler
Google hat diese Woche einen Javascript Debugger/Profiler für Chrome veröffentlicht, bisher waren ja nur die WebKit-Tools enthalten.
via golem
February 2, 2009
Firebug console.log – graceful degradation and cool features
My favorite feature in firebug is console.log but it has one problem, you have to remove all calls from source code before going live else your visitors will get many many javascript errors. But there is a really simple solution for that problem, getfirebug.com hosts a javascript which creates a fallback console object if firebug is not installed.
[sourcecode language="javascript"]
[/sourcecode]
So, now we are on the save side and can play around with the console object. The usually most used method is “log”, it simply prints something to the console. Strings, Arrays, Objects, Dom, XML … everything works, log can also print more than one variable at once.
[sourcecode language="javascript"]
console.log(‘A String’, ['an','array'], document.getElementById(‘domObject’));
[/sourcecode]
Console can write messages with a specific type, so you can print errors and warnings to your console.
[sourcecode language="javascript"]
console.error(‘an error’);
console.warn(‘a warning’);
[/sourcecode]
Outline object members in console with the ‘dir’ method.
[sourcecode language="javascript"]
console.dir({nice:’to’, see:’that’, cool:function(){ alert(‘cool’); }});
[/sourcecode]
If you wanna see all cool features, now and live, there is an example page on bohuco.net/code:
http://bohuco.net/code/firebug-logging/
More infos:
http://getfirebug.com/console.html
Google Code – Fun with Firebug
October 12, 2008
Playing around with gameQuery
gameQuery, a new jQuery plugin, provides functions for creating browser games. In this early stage gameQuery supports a main-loop, game area (playground), sprites with CSS animations and sounds (not tried yet).
I have played around with gameQuery and here is the result. A simple Pong clone that should work in IE6/7, Chrome and Firefox.
The current gameQuery version is 0.2.5 and so there are some points for improvement. Every sprite needs an animation and every animation needs an image even if you don’t need it. Playground is always position:absolute and it has a black border. Only little things that you can override.
October 11, 2008
Javascript private members
Die definitive Link-Sammlung:
http://www.crockford.com/javascript/private.html
http://mckoss.com/jscript/object.htm
Wichtig: Private Variablen können nicht aus den public Methoden gelesen werden sondern nur aus den private-Methoden … also MUSS es für die privaten Variablen Setter- und Getter-Methoden geben. Und, die privaten Methoden werden NICHT mit “this” aufgerufen:
[sourcecode language='javascript']
var test = function() {
// private variable
var status = 1;
// private method
var getStatus = function() {
return status;
}
return {
publicMethod: function() {
var status = getStatus(); // NOT this.getStatus();
}
}
}
[/sourcecode]
