1

私はIE9でこの奇妙な問題を抱えています(他のIEではテストしませんでした)-ウェブサイトにログオンし、ページを更新するたびに、次のコードが起動します:

jQuery(window).bind("beforeunload", function() {
    $.get('session_destroy.php', function() {
    //  alert('done');
    });
});

面白いことに、開発者ツール F12 を呼び出して更新すると、session_destroy.php へのクイック呼び出しが表示されますが、更新時にログアウトされません!

ここに私の文書定義があります:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> //- note this i need because on intranet sites IE gt 8 force compatibility mode of IE7 - this makes all jquery sucks..
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

これが関連しているかどうかはわかりませんが、最初からログインしないため、2回ログインする必要がある場合があります...ログインにはajaxも使用しています。

$(document).ready(function(){

    $("#submit").click(function(){
        username = $("#username").val();
        password = $("#password").val();
        $.ajax({
            type: "POST",
            url: "login_db.php",
            data: "username="+username+"&password="+password,
            success: function(html){
                if(html.length>0)
                {
                    switch(html)
                    {
                        case "1": tab = "Production";
                        break;
                        case "2": tab = "Recordings";
                        break;
                        default: tab = "Summary";
                    }
                    window.location.hash = '';
                    var url=window.location;

                    window.location.href= url+tab;
                    location.reload();
                }
                else
                {
                    $("#add_err").html("Wrong username or password");
                }
            }
        });
        return false;
    });
});

すべてが Firefox と Chrome で正常に動作します

4

0 に答える 0