| Issue 7469: | Support for navigator.onLine toggling and online/offline events | |
| 56 people starred this issue and may be notified of changes. | Back to list |
Sign in to add a comment
|
Chrome Version : 2.0.160.0 URLs (if applicable) : https://developer.mozilla.org/En/Online_and_offline_events Other browsers tested: Add OK or FAIL after other browsers where you have tested this issue: Safari 3: FAIL Firefox 3: OK IE 7: FAIL IE 8: OK What steps will reproduce the problem? 1. Load testpage from Mozilla Developer Center 2. Bring down network interface 3. What is the expected result? Page should update, showing support for both the navigator.onLine (note spelling) Boolean property and the online/offline events. What happens instead? Nothing. Please provide any additional information below. Attach a screenshot if possible. I have reported this to the webkit team here: https://bugs.webkit.org/show_bug.cgi?id=19105 Note that, at one time, this was fixed for Safari/Mac. It has since regressed and I am petitioning to have the bug reopened. It has never worked for Safari/Windows. Cheers, - Bill
Comment
1
by
bedn...@gmail.com,
Feb 6, 2009
,
Feb 7, 2009
(No comment was entered for this change.)
Labels: -Type-Bug Type-Feature
,
Jan 22, 2010
I am facing the same issue but it looks like it has been fixed in Webkit. I am attaching a small test html page that I used to test. I tested it on FF(3.6), Chrome (dev channel) and Safari (4.0.4) for windows. The test: - clicking the button shows an alert with the value of navigator.onLine variable - I basically tested by clicking the button when connected and when disconnected. FF and Safari give the desired results but Chrome does not. It looks like the Chromium codebase has not picked up the fix from the Webkit core - https://bugs.webkit.org/show_bug.cgi?id=11284
,
Mar 30, 2010
This will impact Offline Web Apps which will be a feature in HTML5. I found IE 8.0 can detect network status and support work offline mode. Firefox just supports work offline mode but fails to detect physical network status change. Chrome does not support both work offline mode menu and navigator.onLine detection. Thanks, -Chengrui
,
Apr 2, 2010
There seems to be another bug in webkit as well: https://bugs.webkit.org/show_bug.cgi?id=32327
,
Jun 29, 2010
uTest Repro in dev build: yes Repro in stable build: yes Accurate Steps: yes Configuration used: Chrome 5.0.375.86 + Chrome 6.0.447.0 dev + Windows 7 x64 This is still reproducible. Test HTML returns 'true' for online and offline.
,
Jul 9, 2010
navigator.onLine and online/offline events are not supported because they are not useful. they only tell you about the status of your immediate network adapter. it doesn't say anything about whether or not you can actually connect to a server. your ISP connection may be down for example, and your local operating system would have no idea. your OS would just be able to tell you that "yes, you have a connection to your router." WONTFIX
Status: WontFix
,
Jul 9, 2010
the only reliable way to determine if you are online is to actually try to make a connection to a server. this forces you to write your application in a more robust way. if you write to navigator.onLine and online/offline events, then your application will not perform well in real network outage/flakiness scenarios.
,
Jul 9, 2010
Issue 38084 has been merged into this issue.
,
Aug 4, 2010
I'd disagree with darin's assessment that online and offline events are not useful. Lets say you are making an ajax call and it fails. Normally at this point, you'd give the user a warning or error message and then add a timeout and retry the call (and keep retrying for a while/forever). But with functional online/offline events and properties you could handle things differently. So when the ajax call first errors out, check window.navigator.onLine. If it is false, then you can definitively tell the user that the error was due to loss of network (instead of having to guess between server timeout and network being down). It is much helpful to the user to say, "You won't get any more updates since you have disconnected from the network", than, "You won't get any more updates, check to see if you have disconnected from the network." Additionally, you can setup a callback for the online event, so that you can _immediately_ retry the ajax call when the browser tells you the network is back. That's much better than the retry scenario because you are probably only retrying the ajax call once every several seconds and the online event would get the application back and running significantly more quickly. So it seems to me that having real offline properties and events is invaluable, particularly in live/websocket/long polling web applications.
,
Aug 18, 2010
Everybody’s entitled to his own opinion, but opinions on wether this is useful or not shouldn’t make a difference in this case. At the end of the day the ononline/onoffline events are part of the HTML5 spec, and all other modern browsers support them already. Why not WebKit/Chrome/Safari?
,
Aug 26, 2010
Putting this back on the radar. I agree with the argument in comment #10. Thanks for your input.
Status: Untriaged
Labels: -Area-Misc Area-WebKit WebKit-Core
,
Sep 9, 2010
putting into m8 since that's the next mstone.
Labels: Mstone-8
,
Oct 15, 2010
The link state is really all we know anything about. I.e. we only know how the physical layer (WiFi/Ethernet) is doing. We don't know any thing about whether the internets are working. Are other implementations only looking at the link state? Anyway, this clearly isn't making m8. Setting to X until we have some clear plan and/or owner.
Labels: -Mstone-8 Mstone-X
,
Oct 15, 2010
In response to Comment 14, Fx3 and IE8 do both use link state for navigator.onLine and the associated events. That's according to testing I've done, but their respective docs seem to say the same: https://developer.mozilla.org/En/Online_and_offline_events http://msdn.microsoft.com/en-us/library/cc304129(VS.85).aspx#status_improvements
,
Dec 7, 2010
Hi, I tested with Safari 5.0.2, Firefox 4.0b7, Chrome Dev build and Opera 10.6. All on Mac OSX 10.6.4 Here's how each of the browser behaves when I turnoff network connection. - gives the navigator.onLine status as false for Safari and FF. - gives the status as true for Opera till I explicitly enable Work Offline which again dont make much sense. Why a user needs to manually enable work offline. - always gives true for Chrome. IMO, this is an extremely important feature for offline web app development. I totally agree with comment #10 and #11 It will be great to see Chromium team putting this on a priority as almost all of the latest browser versions (including webkit based Safari) behaves as expected (except for Opera). Thanks for your effort in advance.
,
Dec 7, 2010
Issue 62052 has been merged into this issue.
,
Feb 2, 2011
I tested this with Firefox 4b10 and it works very nicely there: If I unplug the cable and disable WIFI it immediately throws the "offline" event. When I put the cable back in, it throws an "online" event. I understand the argument that this is not a 100% precise way to determine if there is a connection to a server or just to a network but it works as a pretty sweet indicator. I hope this will make it's way into Chromium soon, because as far as offline applications go, Chrome has always been on the leading edge!
,
Feb 2, 2011
As per issue 38084 also see http://hacks.mozilla.org/2010/01/offline-web-applications/ This shows a working demo as to why you might need this.
,
Feb 9, 2011
(No comment was entered for this change.)
Status: Assigned
Owner: ad...@chromium.org Labels: -Mstone-X Mstone-11
,
Feb 10, 2011
(No comment was entered for this change.)
Blockedon: 53473
,
Feb 11, 2011
am creating chrome web app that can work offline. would like to receive the events. at least let navigator.onLine work!
,
Mar 2, 2011
(No comment was entered for this change.)
Labels: -Mstone-11 Mstone-12
,
Mar 4, 2011
The following revision refers to this bug:
http://src.chromium.org/viewvc/chrome?view=rev&revision=76985
------------------------------------------------------------------------
r76985 | adamk@chromium.org | Fri Mar 04 14:42:08 PST 2011
Changed paths:
M http://src.chromium.org/viewvc/chrome/trunk/src/net/socket/client_socket_pool_base.h?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/net/base/network_change_notifier.cc?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/net/base/network_change_notifier_win.cc?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/net/base/network_change_notifier_win.h?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/render_messages_internal.h?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/net/socket/client_socket_pool_base.cc?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/net/base/network_change_notifier.h?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/jingle/notifier/communicator/login.h?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/intranet_redirect_detector.h?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/google/google_url_tracker.h?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/renderer/render_view.cc?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/net/base/dnsrr_resolver.h?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/sync/engine/syncapi.cc?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/tab_contents/tab_contents.cc?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/io_thread.cc?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/net/proxy/proxy_service.cc?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/net/spdy/spdy_session_pool.cc?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/net/base/host_resolver_impl.h?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/net/base/host_resolver_impl.cc?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/net/spdy/spdy_session_pool.h?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/io_thread.h?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/net/proxy/proxy_service.h?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/tab_contents/tab_contents.h?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/renderer/render_view.h?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/google/google_url_tracker.cc?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/intranet_redirect_detector.cc?r1=76985&r2=76984&pathrev=76985
M http://src.chromium.org/viewvc/chrome/trunk/src/jingle/notifier/communicator/login.cc?r1=76985&r2=76984&pathrev=76985
Plumb through NetworkChangeNotifier::IsOffline() to WebKit, enabling
navigator.onLine and online/offline events. Only works on Windows at the moment, as IsCurrentlyOffline() is supported only by NetworkChangeNotifierWin.
Most of the changes are due to the need to support two different kinds of NetworkChangeNotifier observers. Both observers currently happen to trigger on the same event, but that could change, e.g., if we store the previous online state and only notify on a change. Thus the need for two different observer interfaces, and associated Add/Remove methods.
BUG=7469
TEST=Load https://bug336359.bugzilla.mozilla.org/attachment.cgi?id=220609, unplug network cable, reload, see that page changes to note offline status
Review URL: http://codereview.chromium.org/6526059
------------------------------------------------------------------------
,
Apr 15, 2011
(No comment was entered for this change.)
Cc: oshima@chromium.org
,
Apr 15, 2011
(No comment was entered for this change.)
Blocking: chromium-os:14211
,
Apr 15, 2011
(No comment was entered for this change.)
Blocking: chromium-os:4558
,
Apr 21, 2011
Issue 79295 has been merged into this issue.
,
Apr 25, 2011
Moving out of M12.
Labels: Mstone13 MovedFrom12
,
Apr 25, 2011
Moving out of M12.
Labels: -Mstone-12 Mstone-13
,
Apr 28, 2011
This is blocking chromium-os:4558 which is breaking a large number of pyauto tests on ChromeOS. Can we get this fixed soon?
Cc: nirnimesh%chromium.org@gtempaccount.com dtu%chro...@gtempaccount.com kr...@chromium.org
Labels: -Pri-2 Pri-1
,
Apr 28, 2011
To be clear, r76985 already enabled this support on Windows, but I'm leaving the issue open to track progress on Mac & Linux implementations.
,
May 2, 2011
Hi, I tried it in on Windows 7 with Chrome Dev Build 12.0.742.12, canary build 13.0.752.0 and 11.0.696.0 but not able to get it working on any. What i am doing is: Load https://bug336359.bugzilla.mozilla.org/attachment.cgi?id=220609, unplug network cable, wait and see that page changes to note offline status Can some tell me in which build this fix is available? Thanks a lot in advance
,
May 2, 2011
Attached a version of the test case that I've tested on Chrome.
,
May 2, 2011
With which Chrome build you tested? I tested this test just on 12.0.742.12 and see that navigator.onLine always returns true and ononline/onoffline events don't fire.
,
May 2, 2011
I tested this on 12.0.742.12 on Windows 7.
,
May 3, 2011
Got it. My machine had Virtual Ethernet Adapters installed. I get onoffline event only if i disable all the network adapters (doesn't matter if they can provide network access or not). Is this behavior fine? When this event should get fired? Virtual Ethernet adapters are not providing you any internet/outside access so you are ideally offline at that time. Network and sharing center shows "No network access" in this situation so onoffline event should fire here. What do you say?
,
May 3, 2011
It's a known issue that this detection isn't perfect: the definition of "online" is a bit fuzzy (what if you could connect to the local network but not any site on the internet?), and as you see, things like virtual interfaces can confuse our detection code. For reasons like this, the "offline" state is, in my opinion, much more valuable to web applications (since it has no false positives) than the "online" state. But thanks for the report, and I'll log this as a feature request for our detection code.
,
Jun 2, 2011
Moving !type=meta|regression and !releaseblocker to next mstone
Labels: -Mstone-13 Mstone-14 MovedFrom13
,
Jun 2, 2011
The following revision refers to this bug:
http://src.chromium.org/viewvc/chrome?view=rev&revision=87699
------------------------------------------------------------------------
r87699 | adamk@google.com | Thu Jun 02 14:56:44 PDT 2011
Changed paths:
M http://src.chromium.org/viewvc/chrome/trunk/src/net/base/network_change_notifier_mac.cc?r1=87699&r2=87698&pathrev=87699
M http://src.chromium.org/viewvc/chrome/trunk/src/net/base/network_change_notifier_mac.h?r1=87699&r2=87698&pathrev=87699
Implement NetworkChangeNotifier::IsCurrentlyOffline() for Mac.
R=willchan@chromium.org
BUG=7469,53473
TEST=load onlineTest.html attachment on bug 7469 ; disconnect/connect network cable
Review URL: http://codereview.chromium.org/7006015
------------------------------------------------------------------------
,
Jun 2, 2011
(No comment was entered for this change.)
Labels: -MovedFrom12 MovedFrom-12
,
Aug 30, 2011
fix it
,
Sep 14, 2011
What is the status of support of this property in safari [webkit]. I can see that bill opened this bug for them but was it resolved. in webkit, i could also see a new bug opened Bug 32555 - [Qt] support navigator.onLine and ononline/onoffline events which was resolved too but the latest safari does not seem to support it.
,
Oct 11, 2011
This is supported in M14 (current stable) on Windows, Mac, and Chromium OS, so I'm closing this bug to better indicate the state of the world. Issue 53473 will stay open until Linux support is landed.
Status: Fixed
Blockedon: -53473
,
Oct 21, 2011
(No comment was entered for this change.)
Labels: Hotlist-GoogleApps
,
Nov 16, 2011
The following revision refers to this bug:
http://src.chromium.org/viewvc/chrome?view=rev&revision=110344
------------------------------------------------------------------------
r110344 | adamk@chromium.org | Wed Nov 16 11:51:53 PST 2011
Changed paths:
M http://src.chromium.org/viewvc/chrome/trunk/src/net/base/network_change_notifier.cc?r1=110344&r2=110343&pathrev=110344
M http://src.chromium.org/viewvc/chrome/trunk/src/net/net.gyp?r1=110344&r2=110343&pathrev=110344
M http://src.chromium.org/viewvc/chrome/trunk/src/net/base/network_change_notifier.h?r1=110344&r2=110343&pathrev=110344
A http://src.chromium.org/viewvc/chrome/trunk/src/net/base/network_change_notifier_linux_unittest.cc?r1=110344&r2=110343&pathrev=110344
M http://src.chromium.org/viewvc/chrome/trunk/src/net/DEPS?r1=110344&r2=110343&pathrev=110344
M http://src.chromium.org/viewvc/chrome/trunk/src/net/base/network_change_notifier_linux.cc?r1=110344&r2=110343&pathrev=110344
M http://src.chromium.org/viewvc/chrome/trunk/src/net/base/network_change_notifier_linux.h?r1=110344&r2=110343&pathrev=110344
Offline state detection for linux, using new D-Bus library.
BUG=53473
TEST=see attachment on bug 7469
Review URL: http://codereview.chromium.org/8249008
------------------------------------------------------------------------
,
Nov 16, 2011
The following revision refers to this bug:
http://src.chromium.org/viewvc/chrome?view=rev&revision=110374
------------------------------------------------------------------------
r110374 | adamk@chromium.org | Wed Nov 16 14:28:06 PST 2011
Changed paths:
M http://src.chromium.org/viewvc/chrome/trunk/src/net/base/network_change_notifier.cc?r1=110374&r2=110373&pathrev=110374
M http://src.chromium.org/viewvc/chrome/trunk/src/net/net.gyp?r1=110374&r2=110373&pathrev=110374
M http://src.chromium.org/viewvc/chrome/trunk/src/net/base/network_change_notifier.h?r1=110374&r2=110373&pathrev=110374
A http://src.chromium.org/viewvc/chrome/trunk/src/net/base/network_change_notifier_linux_unittest.cc?r1=110374&r2=110373&pathrev=110374
M http://src.chromium.org/viewvc/chrome/trunk/src/net/DEPS?r1=110374&r2=110373&pathrev=110374
M http://src.chromium.org/viewvc/chrome/trunk/src/net/base/network_change_notifier_linux.cc?r1=110374&r2=110373&pathrev=110374
M http://src.chromium.org/viewvc/chrome/trunk/src/net/base/network_change_notifier_linux.h?r1=110374&r2=110373&pathrev=110374
Offline state detection for linux, using new D-Bus library.
Relanding with fix for component build: use NET_EXPORT_PRIVATE
in network_change_notifier_linux.h.
BUG=53473
TEST=see attachment on bug 7469
R=willchan@chromium.org
Review URL: http://codereview.chromium.org/8575013
------------------------------------------------------------------------
|
||||||||||
| ► Sign in to add a comment | |||||||||||