Yesterday I was looking at XHTML and accessibility standards for BlogEngine.NEXT and found something I haven’t noticed before in the W3C specs. I came across some rules about specifying the default script and style sheet language when trying out the Total Validator.

By specifying the default script language you tell the browser what language all the onclick and other events specified in the HTML should be interpreted in. It’s probably always text/javscript but it could be text/vbscript or something else.

The same goes with the style sheet type. It’s always text/css when you use the style attribute in the HTML.

To tell the browser about the default script language and style sheet type, you can either add meta-tags or custom HTTP headers.

The meta-tags

<META http-equiv="Content-Style-Type" content="text/css">
<META http-equiv="Content-Script-Type" content="text/javascript">

The HTTP headers

Response.AppendHeader("Content-Style-Type", "text/css");
Response.AppendHeader("Content-Script-Type", "text/javascript");

The headers should be added to all .aspx pages. The easiest way to do that is in the master page or global.asax.

The W3C has created a standard for location sharing called Geolocation. It allows any person to share her location with any website at the click of a button. Imagine the possibilities with this.

Here is a scenario:

You’ve arrived in a new city, a new continent, a new coffee shop. You don’t really know where you are, and are looking for a good place to eat. You pull out your laptop, fire up Firefox, and go to your favorite review site. It automatically deduces your location, and serves up some delicious suggestions a couple blocks away and plots directions there.

Firefox 3.1 will have this build in, but until then we can use a Firefox add-on called Geode. Basically, it uses your Wi-Fi network to find your exact location and then passes it to a JavaScript callback method on your website. Already now, services like Pownce, Fire Eagle and ZYB uses this to improve the user experience of their services.

Here is a screenshot of what it looks like when Geode ask for a location:

Geode add-on

Getting started using Geode

You should start by downloading the Geode add-on for Firefox and make sure your Wi-Fi is turned on. Then fire up your HTML editor and add this JavaScript to one of your pages:

function geodeAsk()
{
 if (navigator.geolocation)
  navigator.geolocation.getCurrentPosition(geoFound, geoNotFound);
}

function geoFound(pos)
{
 var lat = pos.latitude;
 var lon = pos.longitude;
 alert(lat + ', ' + lon);
}

function geoNotFound()
{
 alert('You must be on a wifi network for us to determine your location');
}   

// Ask the browser for its location
geodeAsk();


Open the page in Firefox. Geode will now ask you if you want to share your location with the page. It’s that simple. Geode then sends the latitude and longitude to the JavaScript callback method and you can now do whatever you want with it. If you want to retrieve the address based on the location, then you need to do a simple reverse GEO lookup.