navigator.onLine returns false positive when in apps using WebView
Reported by
kinos...@gmail.com,
Feb 11 2018
|
||||||||
Issue descriptionSteps 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.
,
Feb 13 2018
,
Feb 13 2018
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!!
,
Feb 13 2018
,
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).
,
Feb 13 2018
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
,
Feb 14 2018
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!!
,
Feb 16 2018
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..
,
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).
,
Feb 24 2018
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.
,
Jun 27 2018
|
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by pnangunoori@chromium.org
, Feb 12 2018