GeoIP2 for retrieving city and region ?

  • Thread starter Îικόλας
  • Start date
C

Chris Angelico

Using plain CGI is going to be painful -- since /everything/ is handled
a whole new page request. You would have to handle session cookies, etc.

Your "index.html" would attempt to run the JavaScript (note that some
users may have JavaScript turned off -- how will you handle that), if it
gets information it would have to do a "GET index2.html?lat=xxx?long=yyy"
or something similar, which will result in a new page load on the user --
hopefully with a cookie set so you know NOT to run the geolocation code on
subsequent pages.

AJAX is a process to allow JavaScript on the browser to interact with a
server (using XML data structures), and likely use DOM operations in the
browser (and the last time I did something on this nature, I had to have
different code for Internet Explorer vs Firefox, and don't know of
Chrome/Opera share one of the others calls) to make changes on the web page
without doing a full submit/render operation

AJAX changes the client end, but not the server (well, you might
change the server's output format to make it easier, but it's not
essential). So you *can* still use the CGI that you're familiar with.

For reference, Firefox/Chrome/Opera/Safari are all pretty much
identical for this sort of work; and the recent IEs (9, I think, and
10) are following them too. There are trivial differences, but for the
basics, it's possible to support IE8+, Chrome, Firefox back as far as
the Iceweasel from Debian Squeeze (I think that's Ff 3.5), and so on,
all from the same code. No per-browser checks required.

ChrisA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top