Does this mean one has to create different set of pages for offline
and online mode. I am writing a simple ASP.NET app, that contains only
two forms. In my application, I want to first detect if the user in
online, if yes those forms function normally, if no
'google.gears.isOnline' then I would procced in offline mode.
I would really appreciate any guidance. T
Thanks in advance !
-Ashish
This is a question that has come up a lot and we are aware it's
something many users would like to see. We would love to implement
google.gears.isOnline, but the problem is how to define an application
being "offline". Offline can mean:
* the browser has the 'work offline' flag set
* the network cable is unplugged
* the vpn is down
* dns is down
* the server you are trying to reach is down
* the server has a bug and cannot process your request
"Offline" can be different each application, so it's hard for us to
make one generic method to handle it for all applications. That's
why, for now, we are leaving it up to the user to decide when their
application is "offline". This issue is on our radar, but we have
other important features we are working on right now.
If we did implement it, how would you want it to work? What
suggestions do you have?
-Ben
p.s. there are a few posts here about this:
http://groups.google.com/group/google-gears/browse_thread/thread/f01a283262a833e5/aef24998003ba237?lnk=gst&q=gears+online&rnum=5#aef24998003ba237
An end user (who we can assume is non-techie) , will want to go into
'offline' mode when anything that prevents him from accessing a page/
server happens. An approach that I was trying out yesterday was
'pinging using AJAX'. I guess something similar to this can be
implemented. I mean,Gears can have a property like
'google.gears.pingURL' and 'google.gears.pingInterval', it might be
possible to detect a situation where the site is unreachable. I have
heard something about 'Comet technology' and maybe something similar
can be useful to maintain a connection. This is just one solution that
comes to my mind.
My 'personal' opinion is that following two possibilities are
important, because in this case the user could have voluntarily
choosen to be offline:
* the browser has the 'work offline' flag set [Switch to offline mode]
* the network cable is unplugged [Out of office or something..in case
of hardware problem..OS will notify him]
In other cases, being offline or online was controlled by external
factors. The user still thinks he is online. Here, when he uses the
application in 'online' mode, he would fail. Even with current
implementations this would happen.
Now somehow , say if Gears can detect this and have a provision of
showing up a custom message like 'your website is unreachable ! would
you like to go offline?' ... and then set a flag like
'google.gears.isSiteOffline'
I can imagine following additions in Gears:
google.gears.isSiteOffline /google.gears.isSiteOffline(sitename)
[site specific flag]
google.gears.isBrowserOffline [cable unplugged AND/OR browsers
offline mode..a global variable]
google.gears.SiteOfflineCallback [points to javascriptcallback
function]
google.gears.BrowserOfflineCallback [might be useful for some ?]
-Ashish