android.2.X系では下のようにプログラムを組んだ場合、バックボタン(戻るボタン)を押した後、実行されない。
jQuery(function($){ $.ajax({ type: 'POST', url: './test.txt', dataType: 'json', timeout: 3000, data: {'hoge':'1'}, success: function(res, ts, x){ }, error: function(x){ try{ res = $.parseJSON(x.responseText); }catch(e){ res = {}; } }, beforeSend: function(xhr){ xhr.setRequestHeader('ajax', true); } }); });で、この場合、どうすればいいのかというと、
Mobile SafariやAndroid標準ブラウザでhistory.backした際にloadイベントを走らせる方法
にも記載されている通り、
window.onunload = function() { };を入れたら実行されましたー。
なんなんだ、この仕様。
0 コメント:
コメントを投稿