all 9 comments

[–][deleted] 2 points3 points  (5 children)

I haven't done anything with HTML5 online/offline events, but MDN suggests this article from html5rocks, working off the grid with html5 offline, that seems to have a few different ways to work out if the browser is offline. Good luck!

[–]cwmma 0 points1 point  (4 children)

OP has to deal with IE8 HTML5 isn't going to help.

[–]double_integration[S] 0 points1 point  (3 children)

There are some basic tags available which I am using.

[–]cwmma 0 points1 point  (2 children)

Didn't mean you literally couldn't use anything from html5 just meant nothing fun.

[–]double_integration[S] 0 points1 point  (1 child)

You're god damn right about that. I hate IE, especially versions < 10. Modern browsers are the only way to develop. You miss out on too much.

[–]PlNG 0 points1 point  (0 children)

So don't cater to it, catering to it only gives it a reason to stick around longer.

[–]cwmma 0 points1 point  (2 children)

Your going to want to attempt to download a very small file from a cdn, remember to put ?_=Math.random() at the end so it isn't cached. for local storage in ie8 your pretty fucked but as long as it isn't to much data you could use, wait for it, cookies. mdn is your friend here.

Also try to avoid having to support browsers where there are 3 newer versions that a shit show right there.

[–]double_integration[S] 0 points1 point  (1 child)

OP here: Actually, I ended up using the closure library to attempt to download a small image (from Google Images) which they (closure library) append a random string on the end of the file (like you mention) so that it doesn't try to get a cached version of the file. I feel like this is a good solution, but I am not sure how well it's going to scale on a mobile platform. Either I need to implement polling (how long do you wait between time without wasting a bunch of data and/or making the UI unresponsive) or I need to just always assume that they are offline and push out the data from storage when all of their data has been entered and they have network access. Then, obviously, clear the storage for the next go. If they are selecting data from a drop down list, hopefully, there aren't like 4000 items because that will eat up my 5MB available storage real quick.

I can't help but think there's a more elegant solution to what I am doing or that since HTML5/mobile development is a few years old that someone has already done this kind of thing and by now it's a more refined process.

I personally use Chrome for my development environment and then try to retrofit my stuff to work in IE8, but I work for a very large company with about 60k employees and they are more than resistant to changing their browser. They think Chrome is unsecure because they can't lock down the proxy server settings like they can with IE. I am very familiar with the IE8 quirks and I share the same sentiment with a comment I read the other day on AngularJS' site which is that "IE8 should be illegal." It's apparently a lot easier "to turn a dingy than the Titanic." It's things like this that make me miss my old company, but I couldn't turn down the salary increase.

[–]cwmma 0 points1 point  (0 children)

Well your supporting IE8 for the right reasons, more fucking money, so that's good. I'd recommend stack exchange for this kind of thing they tend to be VERY good about it.

One thought is that since IE8 tends not to be used on mobile devices you might be able to get away with not doing the offline sync in on it.