Connecting to a web page if ther is an internet connection


Recommended Posts

Hi,

I have the company logo as a symbol on the screen. How can I use the action for this symbol to connect to the company website and display it?

If there is no internet connection I would want to display a page that has the contact details as an alternative. Is there a way of checking if there is an internet connection available?

Thanks,

Martin

Link to comment
Share on other sites

You'd use system.shellexecute() to trigger the default browser with the URL as the command line:

system.ShellExecute("http://www.azeotech.com")

To detect if there is an internet connection is a bit harder. You'd probably have to open a TCP client connection to a known web page (perhaps your own), by IP address to port 80. If you can successfully connect, then you have an internet connection, otherwise, you don't. Of course to detect if you are connecting you'll have to send a query and check for a response. To do a simple web GET request send to a web server:

GET /index.html1310

of course replacing 1310 with chr(13) + chr(10) if you are doing it from script. You should get a response even if index.html doesn't exist.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.