jump to navigation

Google Maps – get latitude and longtitude for a location November 25, 2008

Posted by maxmil in : GIS,javascript , add a comment

Useful trick that i got from here

Navigate so that the point you want is in the center of the map.

Then put this in the address bar of your browser.

$javascript$:void(prompt('',gApplication.getMap().getCenter()));

Note remove the $’s from the above command. I had too put them in to allow my WYSIWIG editor to process the code.

Lightbox a fantastic javascript library May 8, 2008

Posted by maxmil in : javascript , add a comment

Great way to display popup images in web pages.

http://www.lokeshdhakar.com/projects/lightbox2/

Determine window size with javascript July 26, 2007

Posted by maxmil in : html,javascript , add a comment

This is a good article.

http://www.howtocreate.co.uk/tutorials/javascript/browserwindow

Firebug – fantastic plugin April 30, 2007

Posted by maxmil in : html,javascript , add a comment

I wish that i’d found this earlier. Firebug is a web development plugin for firefox with a whole load of excellent features. Check it out!

Making ajax calls from opener bug in firefox February 21, 2007

Posted by maxmil in : Ajax,javascript , add a comment

I’ve stumbled on a problem using ajax in firefox. I have a popup window that when the user clicks the “Accept” button invokes a method in its opener and closes. Whatsmore the method called in the opener is an ajax call. In the popup the code looks something like this:opener.makeAjaxCall();
close();

The problem with this is that the XMLHttpRequest object that comes back from the call is empty. It turns out that this is a documented bug in firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=317600). The problem is that the request object is incorrectly associated with the popup window rather than its opener.

Fortunately there is a work around for this that involves calling the openers method in a setTimeout. By using a setTimeout the call will be associated to the opener rather than the popup. The resulting code would look like this:opener.setTimeout('makeAjaxCall()', 0);
close();

Subverting Ajax January 13, 2007

Posted by maxmil in : Ajax,javascript,Security , add a comment

Security risks related to Ajax and ways to execute javascript using XSS.

http://www.wisec.it/vulns.php?page=9

http://www.wisec.it/rdr.php?fn=Projects/1158-Subverting_Ajax.pdf

Númeric precision in javascript September 26, 2006

Posted by maxmil in : javascript , add a comment

Due the the limited number of bytes that javascript uses to store numbers certain decimals are not stored exactly.

For example try this:

alert(157.26+0.04)

Thus for númeric precision rounding should always be aplied to and mathematical operation.