How to implement offline capable Single Page Application with Breeze.js and HTML5 local storage

无人久伴 提交于 2019-12-03 16:00:50

Looks like the HTML5 provides 5MB local storage, which persists until cleaned and is useful for storing JSON values with XMLHttpRequest.

HTML 5 navigator.onLine property provides offline detection. True if online, false if not

 var nav = window.navigator;
 if(nav.onLine) {
    // do HMLHttpRequests etc
 }
 window.addEventListener('online', function() {   });
 window.addEventListener('offline', function() {   });

For more information check Building Hybrid Mobile Applications with HTML5

@mitaka pointed you to connection change detection.

For using BreezeJS to save entities to local storage, the "Export/Import" topic in the BreezeJS documentation provides valuable clues. The "exportImportTests.js" file in the "DocCode" sample demonstrates some of the techniques described there.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!