nikhilk / scriptsharp

Script# Project - a C# to JavaScript compiler, to power your HTML5 and Node.js web development.
http://scriptsharp.com
Other
659 stars 183 forks source link

Check internet connectivity using Script# #423

Closed parthangshu closed 10 years ago

parthangshu commented 10 years ago

Hi Nikhil,

I have to check internet is available or not using Script#. I tried Navigator.Online property. But it is not working.

Could you please give some sample code from your blog or something like that.

Many thanks, Partha

michaelaird commented 10 years ago

Have you read this: https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine.onLine ?

Navigator.online is not reliable and behaves differently in different browsers. If you search StackOverflow you can find some different solutions for checking connectivity in javascript. These can easily be adapted to Script#.

In general, I would always suggest searching for javascript solutions to these problems and then adapting them to Script#.

On Friday, May 9, 2014, parthangshu notifications@github.com wrote:

Hi Nikhil,

I have to check internet is available or not using Script#. I tried Navigator.Online property. But it is not working.

Could you please give some sample code from your blog or something like that.

Many thanks, Partha

— Reply to this email directly or view it on GitHubhttps://github.com/nikhilk/scriptsharp/issues/423 .

nikhilk commented 10 years ago

I've also mentioned this several times to you ... but will repeat. As Michael mentioned - you need to first look at how you'd do something in javascript, rather than search for some special script# solution to most of your questions.