【发布时间】:2014-01-20 20:45:05
【问题描述】:
我使用 .htaccess 将我的所有流量路由到单个 index.php 文件。下面的代码用于引导流量,但由于某种原因,它不能与后退按钮一起使用。我不知道该怎么做才能使后退按钮正常工作。我已经尝试了各种方法并在 Google 上搜索了很多东西,但都没有奏效,所以我希望这里有人可以提供帮助!
<?php
if(isset($_GET['parameters'])) {
if($_GET['parameters'] == "repair")
include 'repair.html';
else if($_GET['parameters'] == "training")
include 'training.html';
else if($_GET['parameters'] == "products")
include 'products.html';
else if($_GET['parameters'] == "about")
include 'about.html';
else if($_GET['parameters'] == "employees")
include 'employees.html';
else if($_GET['parameters'] == "training")
include 'training.html';
else if($_GET['parameters'] == "newaccount")
include 'newaccount.html';
else if($_GET['parameters'] == "contact")
include 'contact.html';
else if($_GET['parameters'] == "recommended")
include 'recommended.html';
else if($_GET['parameters'] == "careers")
include 'careers.html';
else
include 'home.html';
}
else
include 'home.html';
?>
到目前为止,我已经尝试并未能使用:window.onbeforeunload
body onunload=""
一定有办法去onunload=location.reload() 什么的!不知何故必须知道语法!
【问题讨论】:
-
后退按钮...对于我们每个 Web 程序员来说,在某些地方都是一种痛苦...
-
hahahaha 这真是太好了,尽管它没有回答我的问题。我以为只有我 :)
-
问题是当你按回的时候,浏览器显示的是最后一个url,但是却返回到最后一次实际加载的页面。任何 AJAX 内容都会被遗忘,因此您必须重新加载它。
-
完全如此,这就是为什么我有 php 来处理这些东西但不知何故它失败了!
-
if(!self.z){self.z=1; [].slice.call(document.links).filter(/./.test, RegExp(location))[0].click();}
标签: javascript php jquery ajax .htaccess