ユーザーのセッションが期限切れになり、デフォルトページがマスターページの下で参照されるときに、ユーザーをdefault.aspxにリダイレクトしています。Twitterのような通知を表示してSession Expired
、FirefoxとGoogle Chromeでは正常に機能しますが、IEでは機能しないことを示します。私は得るInternet Explorer cannot open site-http://localhost:1335/order/Default.aspx?Sid=1 Operation aborted
これをグーグルで検索したところ$(document.body).append()
、bodyタグが問題になる前に、スクリプトをページの下部に移動すると、どのブラウザでも通知が機能しないことがわかりました。
これが私のマスターページです、
<head runat="server">
<title></title>
<script src="Javascript/Jquery1.4.js" type="text/javascript"></script>
<script type="text/javascript">
function topBar(message) {
$("#alertmsg").remove();
var $alertdiv = $('<div id = "alertmsg"/>');
$alertdiv.text(message);
$alertdiv.bind('click', function() {
$(this).slideUp(200);
});
$(document.body).append($alertdiv);
$("#alertmsg").slideDown("slow");
setTimeout(function() { $alertdiv.slideUp(200); }, 5000);
}
</script>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
そして私のtopbar関数は私のdefault.aspxページで呼び出されます。
protected void Page_Load(object sender, EventArgs e)
{
Int64 id = GetId(Request.RawUrl.ToString());
if (id == 1)
{
ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "json", "topBar('Session Expired');", true);
}
}