开发者

Back button skipping php pages

开发者 https://www.devze.com 2023-04-06 06:19 出处:网络
I have a website that consists of entirely php pages. If you do the following: Google -> php page1 -> php page2 -> hit the browser back button and you go back to Google

I have a website that consists of entirely php pages. If you do the following:

Google -> php page1 -> php page2 -> hit the browser back button and you go back to Google

I want the user to get taken back to php page1 instead of 开发者_如何学JAVAGoogle when they hit the back button on php page2.

I have a feeling this is to do with the automatic scripts, generated by php, that stop the browser caching pages. However, I don't want the pages to be cached as this would stop the content being updated.

Thanks for any advice!


function goToTag(tagid, tagloc){
  location.replace("main.php?tagid="+tagid+"&result="+tagloc);
}

Switch it to location.href="main.php?tagid="+tagid+"&result="+tagloc; and you'll be just fine. location.replace does what it says on the tin - it replaces the current history item with the new page.

0

精彩评论

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