Check if a website is online or offline

Hello, is possible to check if a website is online or offline? I’ve tried with CustomWebView, but can’t get a response. Basically I would like that when I press the button, I get a response through the label “Online” or “Offline”. Thanks to everyone.

yes, you can try to get the source of the web and there is a function who advise if is an error or not

You can give me a tips?

Are you wondering if a website will be down? Or if the app will be with or without internet access? Website down is something …
.
.

.

.
almost exceptional …

You can use the webviewtools with a webview in your app (it can be hided) set the url to the website you want to know if is online and use the function : .OnReveivedError and .OnPageFinished > you can know with this function if the web is working and with the error function if it is not.

1 Like

Yes, when i press the button “Check” i want a response (label) with “Offline” or "Online.

ok, then in the function .OnReveivedError set the label to Offline and in the other function set the label to Online

1 Like

InkedCattura_LI

Ok, i tried, but when i press the button, i receive every time the response “Online” also if i am offline.

ok set the setwebviewer before go to url.
if it doesn’t works use the Webviewtools GetSourceHtml and instead the onpagefinished use the GotHtmlSource function to set the online label.
If it continues giving the online alltime you can check the size of the output (the source html) and if it’s 0 it means is offline and if it’s >0 then is online

1 Like

InkedCattura_LI
If i use GotHtmlSource, not working, to check the size i need to use GotHtmlSource?

You can try this:
DownWeb

PS: Let us know if it works.

1 Like

Seems working fine, i tried without connection, but if the server is down still working?

Try this now:

2 Likes

Ok if i am connected, i get online, if im not connected is blank (because i have not set the message), so i think working now.

Just put the “else” to “if is connected” and there you can do what you want.

If you solved your problem, press kindly the Solution button.

1 Like

Yes, thanks a lot :smiley:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.