New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 811122 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

navigator.onLine returns false positive when in apps using WebView

Reported by kinos...@gmail.com, Feb 11 2018

Issue description

Steps to reproduce the problem:
1. start an android-application, which checks "navigator.onLine" in a webview (ex: https://play.google.com/store/apps/details?id=com.kinoseed.matchcolor  )
2. turn off WiFI and mobile data
3. check what "navigator.onLine" returns 
ex: in the app above, press "camera roll" icon (second one from the left), and if navigator is offline, it will show a warning message in red.

What is the expected behavior?
navigator.onLine to return false, when WiFi and mobile data are turned off.

What went wrong?
navigator.onLine returns true, when WiFi and mobile data are turned off.

Did this work before? N/A 

Chrome version: 64.0.3282.137  Channel: n/a
OS Version: 7.1.2
Flash Version: 

In WebView, "navigator.onLine" appears to work properly until it is loaded in an android app.
The example app here, is a simple wrapper, which loads https://kinoseed.com/ in a webview.
 
Labels: Needs-triage-Mobile

Comment 2 by rtoy@chromium.org, Feb 13 2018

Components: -Blink Mobile>WebView
Cc: sandeepkumars@chromium.org
Labels: WV-Triaged
Tested the issue in WebView and couldn't reproduce the issue.

Steps Followed:
1. Enabled WebView
2. Installed kinoseed
3. Turned off Wifi and Mobile data
4. Clicked on Load target image
5. Observed the Camera roll

Chrome versions tested:
64.0.3282.137

OS:
Android 7.0.0

Android Devices:
Samsung J7

@pacukas19 -- Could you please find the above observations and help us with a screencast for further triaging.

Thanks!!
Labels: Needs-Feedback

Comment 5 by kinos...@gmail.com, Feb 13 2018

Steps:
1. Enable WebView
2. Install kinoseed
3. Turn off Wifi and Mobile data

4. Start the app you downloaded, and press the second icon (see attached screenshot)
If "navigator.onLine" has returned false, the message "This feature requires online access. It appears you are offline" will appear.

Note: 
- If you run the application in the browser (by visiting https://kinoseed.com ), it produces the *proper result*. 
- If you install as PWA (add to homescreen), and run the application from the PWA-generated link, it produces the *proper result*.
- Only when the webview is loading the page through an app, "navigator.onLine" *produces false positive* (and the app never knows it's offline).
Screenshot_2018-02-13-12-43-28-832_com.android.chrome.png
880 KB View Download
Screenshot_2018-02-13-12-43-40-913_com.kinoseed.matchcolor.png
1.1 MB View Download
Project Member

Comment 6 by sheriffbot@chromium.org, Feb 13 2018

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "sandeepkumars@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: FoundIn-66 Target-66 FoundIn-64 FoundIn-65
Status: Untriaged (was: Unconfirmed)
Tested the issue in WebView and could reproduce the issue.

Steps Followed:
1. Enabled WebView
2. Installed kinoseed
3. Turned off Wifi and Mobile data
4. Clicked on Load target image
5. Observed the Camera roll

Chrome versions tested:
64.0.3282.137

OS:
Android 7.0.0

Android Devices:
Samsung J7

Observing the same behaviour since M58. Hence marking this issue as Non-Regression issue.

Please navigate to below link for log's and video--
go/chrome-androidlogs/811122

Note: This issue is not observed in Mobile Chrome.

Thanks!!
hmm strange just tested the navigator.onLine property with WebView M66 (on a pixel2 device) with the sample url:
https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_nav_online

the online property appears to work ok, including when app is started with wifi switched off initially..
- are you using some specific device?
(note that there might be a slight delay when enabling wifi until the online=true, which is probably irrelevant here though)

Tried the kinoseed app and it doesn't seem to show anything when started with wifi switched off.. this might be due to development device with next version of android.. however I would expect it to work since it works when wifi is enabled..

Comment 9 by kinos...@gmail.com, Feb 17 2018

Tim, as explained above, the false positive happens when a *compiled android app is loading the webview*.

Just waited 3 minutes after turning off wifi and mobile data, and navigator.onLine still returns positive.

note: after installing the app, run the app at least once with internet access. Only then turn off the wifi (it needs to connect once to set the serviceworkes and cache resources for offline availability).
Cc: jamwalla@chromium.org
Labels: -Pri-2 Pri-3
Status: Available (was: Untriaged)
I think this is a real bug - Tim is right that navigator.online works in the provided url, but if a webview in an app runs the javascript directly, navigator.onLine is always true. Attatched in an apk that calls
WebView.evaluateJavascript("navigator.onLine", ...)
and toasts the result on a nbutton press - for me, it's showing true when wifi and data are off.

Don't think it's a (recent) regression, i reproed in 62-64.
app-debug.apk
1.5 MB Download
Cc: -jamwalla@chromium.org

Sign in to add a comment