0

HTML5、Javascript、jQuery Mobile、オフラインストレージを使用してモバイルアプリを開発しています。

(同じドメイン上の)モバイルアプリにJSONオブジェクトの配列を提供するwepアプリがあります。JSONオブジェクトを取得し、それらをwebsqlデータベースに保存してから、クリックできる順序付けされていないリストを作成します...

デバイスがオフラインモードの場合、オフラインデータベースからデータをプルし、WebアプリからのJSONの取得をバイパスします。次に、デバイスが次にオンラインになると、データの新しいコピーを取得できます。

cache.manifestファイルを作成している部分に到達しました。基本的には次のようになります。

CACHE MANIFEST

CACHE:
index.html
app.html

NETWORK:
http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.js
http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.css
http://code.jquery.com/jquery-1.4.3.min.js
js/data.js
js/script.js

ただし、追加するとすぐに

<html  manifest="cache.manifest">

そして、$。getJSONが停止するページをリロードします(data.jsにあります)。そのファイル内の他のJSコードは実行されているように見えますが、その機能です。

ロード時に実行される関数は次のとおりです。

function getAppointments(){
// Update appointments ONLY when online
if(navigator.onLine = true){
    console.log('Application Online.')

    // create appointments table
    createAppTable();
    $.getJSON("http://site.com/OptiQuoteApp/index.php/appointments/download/", function(data) {
        $.each(data,function()
        {
            // Save appointments in database
            updateAppointments(this.quote_id, this.start_date, this.reference, this.first_name+' '+this.last_name, this.comment);
        });
         getAppointmentsList();
    });
}else{
    console.log('Application Offline.')

}
getAppointmentsList();

}

ノート。私はそれがsite.com(セキュリティのために...)と言っていることを知っています

スクリプトはcreateAppTable()まで取得します。その後はもうありません。

誰かアイデアはありますか?

ビリー

とても有難い

4

1 に答える 1

3

マニフェストファイルの「NETWORK:」の下に*を追加してみてください。そうすれば、特にキャッシュされていないものはすべてサイトから取得されます。

NETWORK:
http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.js
http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.css
http://code.jquery.com/jquery-1.4.3.min.js
js/data.js
js/script.js
*
于 2011-07-18T16:56:56.580 に答える