0

キャッシュ マニフェストを含む HTML5/Javascript (サーバー上の PHP/MySQL) アプリがあり、Firefox を除くほとんどすべてのモバイルおよびデスクトップ ブラウザーで問題なく動作します。

キャッシュ マニフェストを削除すると、Firefox で正常に動作します。そのため、Firefox のキャッシュ マニフェストがおかしいのですが、私にはわかりません。ファイルが Cache-Control: no-store, no-cache ヘッダーを送信しても、キャッシュからファイルをロードしています。

このファイルは、LinkedIn アクセス トークンを取得するための OAuth ダンスを処理し、次の手順に従います。

  1. アプリは window.location.replace('file.php') を使用して Javascript 経由でファイルを呼び出します
  2. file.php がロードされ、file.php?param=initiate にリダイレクトされます
  3. file.php?param=initiate が読み込まれ、LinkedIn からリクエスト トークンを取得し、LinkedIn 認証ページにリダイレクトされ、次に file.php?param=initiate&otherparameters にリダイレクトされます
  4. file.php?param=initiate&otherparameters が読み込まれ、otherparameters を使用して LinkedIn からアクセス トークンが取得され、アクセスできるようになったためアプリが再読み込みされます。

ただし、Firefox (Windows 7 の 16.0.2) では、次のようになります。

  1. アプリは window.location.replace('file.php') を使用して Javascript 経由でファイルを呼び出します
  2. file.php が読み込まれ、file.php?param=initiate にリダイレクトされます (FireBug は Status 302 Found を示し、応答ヘッダーは場所 /file.php?param=initiate を示します)。
  3. file.php?param=initiate をロードし、LinkedIn から要求トークンを取得しますが、LinkedIn 認証ページにリダイレクトしません: 404 ページが表示されます (FireBug は Status 302 Found を示し、応答ヘッダーは場所 https:linkedin.com/ を示します)。認証リンクが表示されますが、Firefox は LinkedIn ページに移動せず、file.php?param=initiate に対して別の GET 要求を行い、キャッシュからそれを読み込みます: ステータス 200 OK (BF キャッシュ) と 404 ページを表示します)。

file.php はキャッシュ マニフェストにありません。

基本的に、LinkedIn 承認ページに移動する必要がある手順 3 の応答ヘッダーの Location には移動しませんが、理由がわかりません。

これを修正する方法についてのアイデアはありますか?

この問題を再現したい場合は、テスト イベントへのリンクを参照してください。LinkedIn 接続要求を送信して、Firebug を監視してみてください。このイベントのすべての LinkedIn プロフィール (私のものを除く) はダミー プロフィールであるため、ランダムな見知らぬ人に LinkedIn 接続要求を送信しても心配する必要はありません。アクティベーションリンクを取得するには、最初に電子メールで登録する必要がありますが、必要に応じて使い捨ての電子メールアドレスを使用できます.

私が試したいくつかのこと:

  1. キャッシュ マニフェストがありません: これで解決しますが、オフライン機能が必要です
  2. no-store、no-cache、must-ravalidate、過去の有効期限などのさまざまな順列でヘッダーを送信します。
  3. キャッシュ マニフェストのエントリ数を減らす
  4. SETTINGS:prefer-online、NETWORK:*、NETWORK:https://*などのさまざまな組み合わせ。
4

1 に答える 1

0

I solved this problem by re-writing my LinkedIn/OAuth library so that it does everything via ajax instead of sending the Location header via PHP.

After much frustration I figured out why this problem was happening, so hopefully this will help others who face a similar predicament.

It turns out the cache manifest does not allow redirects to outside domains (this is probably documented somewhere, but it didn't show up for me when I searched for a solution).

Part of the problem was that I didn't know the redirect was causing the problem. I thought it was just the weirdness of the cache manifest. After all, it worked fine on Chrome and Safari and I didn't get any useful debugging info from Firebug.

Here's a useful article on the gotchas of cache manifest (this issue is listed as Gotcha #8).

Here's a link to the HTML Offline Spec (this issue appears to be listed in section 6.7.6(4), but the document is so opaque I can't event tell whether that's really what it's referring to).

于 2012-11-20T15:54:27.450 に答える