キャッシュされたファイルから取得されないように、クエリ文字列でリロードするようにメインページを設定しようとしています。ページはindex.phpですが、ページが読み込まれるたびに、一意の文字列が追加されます(私の前の質問に対するRocketのコメントの回答のように)。
ログインを認証するphpに統合したいと思います。
このようなものは良い考えですか
<?php
require_once('login-config.php');
//use javascript cookie to detect if the page is coming from hash
//and if so, redirect to a new url with a ?<?=time()?> query sting
if ( !isset$($_COOKIE['login_cookie'] )
{
//render login-form page
}
else
{
//redirect to the content page
}
このページからのjavascriptキャッシュ/Cookieチェック(次のように)
var uniqueKey = '<%= SomeUniqueValueGenerator() %>';
var currentCookie = getCookie(uniqueKey);
var isCached = currentCookie !== null;
setCookie(uniqueKey); //cookies should be set to expire
//in some reasonable timeframe
私はこのようなことをすべきだと思います、
//best guess is that I update this uniqueKey every time I update the page
//and want it not to load from cache
var uniqueKey = 'v1.1';
var currentCookie = getCookie(uniqueKey);
var isCached = currentCookie !== null;
if (!isCashed){
setCookie(uniqueKey);
window.location'?".time().";'
} else {
window.location'?".time().";'
}
しかし、私はそれをすべてまとめる方法が正確に少しわかりません。
ありがとう