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.
精彩评论