语言

Menu
Sites
Language
Network state

Hello,

Is it possible to determine if there is a network or not in  device from web app?

响应

3 回复
Lakshmi Grandhi

Hi,

You can use SystemInfo API to check network

https://developer.tizen.org/dev-guide/2.2.0/org.tizen.web.device.apireference/tizen/systeminfo.html#::SystemInfo::SystemInfoWifiNetwork

https://developer.tizen.org/dev-guide/2.2.0/org.tizen.web.device.apireference/tizen/systeminfo.html#::SystemInfo::SystemInfoNetwork


 

Marco Buettner

You can also use:

var networkState = navigator.onLine;

if(networkState)
{
    //TODO: Write your network specific code here
}
else
{
    alert("Network not available");
}

More infos you can find here: http://www.whatwg.org/specs/web-apps/current-work/#navigator.online

Andrew Richeson

Marco Buettner great Information share