誰かが私のサイトにアクセスしたすべてのページで、javascript でダイアログ (これは単なるテキストであり、他には何もありません) を開きます (はい、それは javascript フレーバーの混合物であることを知っています-まだこれに取り組んでいます):
$(document).bind("pageinit", function(){
if( getCookieValue('instructionseen') == false)
{
$.mobile.changePage("/php/instructions_alert.php");
document.cookie ="instructionseen=yes; path=/;";
}
});
このスクリプトは、ユーザーがダイアログを 1 回だけ表示するように Cookie を設定します。つまり、サイトに来て、いくつかの指示があるダイアログを取得し、それを閉じて続行するという考えです。
Chrome v24 の問題 (テストできないモバイル ブラウザーで発生するのではないかと心配しています) は、ダイアログを閉じると履歴が 2 ページ戻るため、クリックしたリンクのあるページに戻ることです。私のサイトにたどり着きます。
たとえば、私のサイトが MS で、RS (リファラー サイト) によってリンクされているとします。
Desired: RS > click to MS > Dialog opens > close it > MS in view
On Chrome: RS > click to MS > Dialog opens > close it > back to RS
これは、JQM が提供する X、または私が提供するこの閉じるボタンを使用して発生します。
<a href='#' onclick='$(".ui-dialog").dialog("close");' data-role='button' data-theme='c'>Close</a>
ダイアログのソース:
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<title>title..</title>
<link rel='stylesheet' href='/design/mobile_style.css'>
<link rel='stylesheet' href='http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css' />
<script src='//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script>
<script src='/js/main_and_JQM_init.min.js'></script>
<script src='http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js'></script>
</head>
<body>
<div data-role='dialog' id='instructions_alert_div' data-overlay-theme='b'>
<div data-role='header' data-theme='d'>
<h1>Important!</h1>
</div>
<div data-role='content' data-theme='c'>
content, just text...
<a href='#' onclick='$(".ui-dialog").dialog("close");' data-role='button' data-theme='c'>Close</a>
</div>
</div>
</body>
</html>
ありがとうございました