How do I get Internet is available or not?

Get help using Construct 2

Post » Wed Jun 18, 2014 10:19 am

Hi, i need this, when internet is available, then i want to show add, but how to get, that internet is on?
B
25
S
4
G
2
Posts: 318
Reputation: 2,501

Post » Wed Jun 18, 2014 10:31 am

Try the Browser object's 'Is online' condition.
Scirra Founder
B
399
S
236
G
89
Posts: 24,525
Reputation: 195,382

Post » Wed Jun 18, 2014 10:47 am

I tried this, but it does not work for me :/ If i use "Is online", action work al the time, even if i am online or not. If I use inverted "Is online" action work never
B
25
S
4
G
2
Posts: 318
Reputation: 2,501

Post » Wed Jun 18, 2014 1:04 pm

It's up to the browser how it defines "online" and sometimes just being connected to a LAN counts. It might also only update it when next making a network request. See: https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine.onLine

If you want a more robust way to check, you need to invent your own system, such as AJAX requesting a server to see if it is reachable.
Scirra Founder
B
399
S
236
G
89
Posts: 24,525
Reputation: 195,382


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 21 guests