Sencha Touch アプリがあります。アプリケーション外 (別の Web サーバー) へのリンクを含むページを含む、さまざまなコンテンツが表示されます。私たちが行ったことは、リンクを処理するために inappbrowser プラグインを追加したことです。
this.getItemsDetail().element.on('tap', function(event, target) {
event.preventDefault();
window.open(target.href, '_blank');
console.log('tap');
}, this, {delegate : 'a'});
これは機能します - 「タップ」がログに記録されます。子ブラウザが開きます。問題は、イベントが「失敗」し、inappbrowser を見逃して、メインの Web ビューに読み込まれることがあります。inappbrowser クラスでデバッグを切り替えることができました。ログは下部にあります。
問題は、この問題が一貫していないことです。再現が難しい場合もあります。クリックしてみると、それが起こります。コアは
2013-11-18 14:11:18.362 CDVWebViewDelegate: Navigation started when state=1
2013-11-18 14:11:18.363 Failed to load webpage with error: CDVWebViewDelegate: Navigation started when state=1
メッセージの正確な意味がわかりません。コードから、「状態 1」は「STATE_WAITING_FOR_LOAD_START」のように見えます
typedef enum {
STATE_IDLE,
STATE_WAITING_FOR_LOAD_START,
STATE_WAITING_FOR_LOAD_FINISH,
STATE_IOS5_POLLING_FOR_LOAD_START,
STATE_IOS5_POLLING_FOR_LOAD_FINISH,
STATE_CANCELLED
} State;
それでも、何が間違っているのか、Webページを「正しい」状態でロードする方法がわかりません。
16.285 tap
16.300 webView shouldLoad=1 (before) state=0 loadCount=-1 URL=http://spokendata.com/
16.300 webView shouldLoad=1 (after) isTopLevelNavigation=1 state=1 loadCount=0
16.301 webView didStartLoad (before). state=1 loadCount=0
16.301 webView didStartLoad (after). state=2 loadCount=1 fireCallback=1
16.465 webView didFinishLoad (before). state=2 loadCount=1
16.466 webView didFinishLoad (after). state=0 loadCount=0 fireCallback=1
18.362 webView shouldLoad=1 (before) state=1 loadCount=0 URL=http://spokendata.com/
18.362 CDVWebViewDelegate: Navigation started when state=1
18.363 Failed to load webpage with error: CDVWebViewDelegate: Navigation started when state=1
18.364 webView shouldLoad=1 (after) isTopLevelNavigation=1 state=1 loadCount=0
18.438 webView didStartLoad (before). state=1 loadCount=0
18.439 webView didStartLoad (after). state=2 loadCount=1 fireCallback=1
18.439 Resetting plugins due to page load.
18.553 webView didFinishLoad (before). state=2 loadCount=1
18.553 webView didFinishLoad (after). state=0 loadCount=0 fireCallback=1
18.553 Finished load of: http://spokendata.com/
18.995 webView shouldLoad=1 (before) state=0 loadCount=0 URL=http://spokendata.com/demo
18.996 webView shouldLoad=1 (after) isTopLevelNavigation=1 state=1 loadCount=0
18.997 webView didStartLoad (before). state=1 loadCount=0
18.997 webView didStartLoad (after). state=2 loadCount=1 fireCallback=1
18.997 Resetting plugins due to page load.
19.152 webView didFinishLoad (before). state=2 loadCount=1
19.152 webView didFinishLoad (after). state=0 loadCount=0 fireCallback=1
19.153 Finished load of: http://spokendata.com/demo
Cordova 3.1.0-0.1.0 を使用しています
更新: ときどき発生します。機能する場合もあれば、機能しない場合もあります。さまざまなページ(大小)で発生します。問題を再現できるアプリ ( https://github.com/tomasfejfar/cordova-bug-01 ) を作成しました。「google.com」の代わりに「seznam.cz」を表示するのに十分な長さの「SEZNAM」リンクをクリックしてみてください...