开发者

Back Button and Javascript

My client's site has notification feature. With that I mean that whenever something happen, user is redirected to notification.php and notification is showed to him.

For exam开发者_如何转开发ple...

"You are signed-up now! Thanks."

After few moments he is redirected to the new location. For example, sign-in.php.

Problem comes when user tries to click browser's back button. he is redirected not to "sign-up.php, but notification... and again redirected.

How to solve this?

For JS redirect I use this...

setTimeout( function() {

  window.location.replace( '<?php echo $location; ?>' );

}, 1000 * 3 );


You could use a conditional redirection. When redirection occurs , set a special context variable to false.... and then if the user uses the back, you just have to check the variable


did you try

sleep(3000);

or time out

after 3 sec call reirect function

function Func1()
{
alert("Delayed 3 seconds");
}

function Func1Delay()
{
setTimeout("Func1()", 3000);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜