Archive for the ‘firefox’ tag
We Know Where Your Browser Lives
Maybe I’m a little late in finding this, but if you have FireFox 3.5 or higher try clicking this link (you will have to agree to let your browser divulge your location to open the link). The JavaScript code run when clicking the link is as follows, and can also be pasted directly into your address bar:
javascript:navigator.geolocation.getCurrentPosition(
function(position){
window.location.href="http://maps.google.com/?ll="+position.coords.latitude+",
"+position.coords.longitude;});
I believe the navigator.geolocation object is also available in Safari, iPhone, and Chrome. The Mozilla documentation provides more details on its use. This StackOverflow question asks which browsers and devices it applies to, and this is set to grow if it becomes part of the browser standards – the W3C has an online draft Geolocation API Specification. They list the following use cases: Read the rest of this entry »
Logging OpenLayers with Firebug
I take it as given that anyone developing with Firefox and OpenLayers has Firebug installed. Firebug has a number of powerful tools that can make the previous nightmare of JavaScript debugging tolerable.
One feature I recently “discovered” are the logging options. It’s definitely a timesaver over my previous method of putting temporary alert(vals); throughout my code. As well as debugging the logging is very useful for automatically documenting formulae in JavaScript with worked examples that can then be pasted straight into the documentation.
An example of the logging capabilities can be seen on my sample OpenLayers page. If you already have Firebug installed you should be able to see the output similar to that below when the page loads.
