Kay is currently certified at Journeyer level.

Name: Klaus Reimer
Member since: 2000-07-11 20:38:27
Last Login: 2014-03-19 22:19:31

FOAF RDF Share This

Homepage: http://www.ailis.de/~k/


Recent blog entries by Kay

Syndication: RSS 2.0

JavaScript Cookie Check

It's strange to see that today in 2012 browser cookies are still making trouble. It shouldn't be that difficult to check with JavaScript if cookies are enabled in the browser. The non-standard navigator.cookieEnabled flag works correctly in Chrome, Firefox, Opera and Safari but Internet Explorer is simply lying to us! It supports this flag (It's not null or undefined) but it is always set to true! So we still need hacks for this browser. It's also strange that I wasn't able to find a working hack on the Internet. So I wrote my own:

 * Checks if browser supports cookies.
 * @return {boolean}
 *             True if browser supports cookies, false if not.
function supportsCookies()
    var cookieEnabled = navigator.cookieEnabled;
    // When cookieEnabled flag is present and false then cookies are disabled.
    // Thanks to IE we can't trust the value "true".
    if (cookieEnabled === false) return false;

    // Internet Explorer is lying to us. So we have to set a test cookie
    // in this browser (We also do it for strange browsers not supporting
    // the cookieEnabled flag). But we only do this when no cookies are
    // already set (because that would mean cookies are enabled)
    if (!document.cookie && (cookieEnabled == null || /*@cc_on!@*/false))
        // Try to set a test cookie. If not set then cookies are disabled
        document.cookie = "testcookie=1";
        if (!document.cookie) return false;
        // Remove test cookie
        document.cookie = "testcookie=; expires=" + new Date(0).toUTCString();

    // Well, at least we couldn't find out if cookies are disabled, so we
    // assume they are enabled
    return true;

Let's explain what this code is doing:

  • When the navigator.cookiesEnabled flag is present and is false then we definitely know that cookies are disabled. All major browsers except Internet Explorer will stop right here when cookies are blocked.
  • When navigator.cookiesEnabled flag is not present (maybe some really old browser) or when Internet Explorer is deteced (Checked with JScript conditional compilation) then a test cookie is set. But we only do this when there are no cookies already set (Because when there is already a cookie then cookies can't be disabled). When our test cookie can be read again then cookies are enabled, otherwise they are disabled.

The code works in IE7-10, Firefox 17, Chrome 23, Opera 12 and Safari 6.

What a shame that code like this is still needed in 2012...

Syndicated 2012-12-31 11:36:00 from K's cluttered loft

Netscape Navigator 4 on Ubuntu Linux 12.10

Feeling nostalgic? Or masochistic? Or are you a real professional and you want to make sure your website even works when it leaks through the time vortex into the year 1998? Then you definitely want to install Netscape 4 on your shiny new Ubuntu 12.10, won't you?

Well, it's a little bit tricky but let me help you.

Continue reading "Netscape Navigator 4 on Ubuntu Linux 12.10"

Syndicated 2012-12-13 15:50:58 from K's cluttered loft

Minecraft and Gnome Shell

If you are running Minecraft on Linux with Gnome 3 then you might have noticed that it doesn't integrate well into Gnome Shell as you can see in these screenshots:

Java class name instead of real application nameNo Dash menu

So instead of having a nice application name like Minecraft Gnome Shell displays the Java class name. This is not really a problem of Minecraft but more a problem of bad Linux integration of Java applications in general. In Gnome 2 and other desktop environments this application name wasn't really important but since Gnome 3 it is crucial to have a valid application name because the Dash (The dock of Gnome Shell) uses it to connect the running application with its application launcher. And that's another problem: Minecraft doesn't create an application launcher. It only provides a JAR file you have to run somehow. And because this launcher doesn't exist and it can't be connected to the running application because of the bad application name you don't get the usual menu in the Dash to add Minecraft to your favorites.

All this can't be tolerated and must be fixed. In this article I will explain how.

Continue reading "Minecraft and Gnome Shell"

Syndicated 2012-09-30 20:49:09 from K's cluttered loft

Minecraft on Linux

Installing Minecraft (version 1.3.1) on Linux is not always as simple as you might think. It's a Java application so it should run on all platforms supported by Oracle but unfortunately sometimes (For some unknown reasons) this doesn't work out of the box. This article describes how to get it running on a current Ubuntu Linux 12.04 on a 64 bit machine and how to create a desktop entry for it so you don't have to start it with this long command mentioned on the Minecraft website.

Continue reading "Minecraft on Linux"

Syndicated 2012-08-14 09:01:06 from K's cluttered loft

How to follow an organization on GitHub

For some reason GitHub does not display a Follow button on organization pages. So you can only follow normal users or repositories. This is pretty sad because it perfectly makes sense to follow an organization if you want to be informed about new repositories created by this organization. Following the organization members instead isn't an option because then you are also notified about their personal activity which might be boring to you. And some members are not even displayed as organization members because membership can be hidden.

Even more confusing is the fact that following an organization technically works. You can add yourself to the follower list and you are also correctly informed about new projects created by this organization. So why is GitHub not showing this button? Don't know. So you have to hack yourself into the follower list. This can be done with a single JavaScript command which you can enter into the JavaScript console of your browser (Naturally you have to be logged in into GitHub):


You can also check the follower list of an organization (The link to this list is also hidden on GitHub). Here is an example URL: https://github.com/openwebos/followers. And when you check the Following list of a user which follows an organization then you can even see a Follow/Unfollow button for the organization. This is most likely a bug, GitHub simply forgot to remove this button when they introduced organizations (Which are simply special kinds of users).

Now I wonder: If it is possible to follow organizations and even notifications about new organization repos works then why isn't it an official feature?

Syndicated 2012-05-25 14:58:24 from K's cluttered loft

76 older entries...


Kay certified others as follows:

  • Kay certified doobee as Journeyer
  • Kay certified andre as Journeyer

Others have certified Kay as follows:

  • jedigeek certified Kay as Journeyer
  • doobee certified Kay as Journeyer
  • Blacky certified Kay as Journeyer
  • matt certified Kay as Journeyer
  • mrchrist certified Kay as Journeyer
  • Schemer certified Kay as Journeyer
  • thomasq certified Kay as Journeyer
  • lucas certified Kay as Journeyer
  • nixnut certified Kay as Journeyer
  • andre certified Kay as Journeyer
  • mikeB certified Kay as Journeyer
  • mobius certified Kay as Journeyer
  • Ausmosis certified Kay as Journeyer
  • dyork certified Kay as Journeyer
  • Krelin certified Kay as Journeyer
  • footrot certified Kay as Journeyer
  • mishan certified Kay as Journeyer
  • fxn certified Kay as Journeyer
  • ks certified Kay as Journeyer
  • jao certified Kay as Journeyer
  • larsu certified Kay as Journeyer
  • ottawaDave certified Kay as Journeyer
  • kih certified Kay as Journeyer
  • rkrishnan certified Kay as Journeyer
  • jameson certified Kay as Journeyer
  • dlc certified Kay as Journeyer
  • ataridatacenter certified Kay as Journeyer

[ Certification disabled because you're not logged in. ]

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!

Share this page