I am developing an Asp.Net MVC application that uses Google maps to show Addresses in a map. The problem is that I need to demo the app in an environment not connected to internet. How can I detect with an script that the app is disconnected not to call the Google maps api functions?
Very similar question to this one. Allen Bargi's answer pointing to the jQuery plugin I think would be the easiest way to detect offline and online, firing an AJAX call to determine whether your MVC application has access to the web.
Another thing you could think about is looking into the Google Gears API which would allow you to work with Google Maps offline. Or so my understanding goes, haven't personally tried it though ... yet :).
This should get you there
using System.Net.Sockets;
private void example{ Boolean isConnected; TcpClient tcpClient = new TcpClient(); tcpClient.Connect("maps.google.com", 80); isConnected = tcpClient.Connected; }
Do you need to do anything this fancy? could you not put a key in the web.config to change when you are in demo mode?