需要在“404”页面上添加请求的 URL。 [HTML]
Need to add the requested URL on a "404"-page. [HTML]
如果用户尝试访问不可用的页面,he/she 将移至自定义 404.html。
我想知道是否可以仅使用 HTML 从自定义 404.html 访问原始请求的 URL?我没有使用 PhP 或任何其他辅助技术。
我的代码如下所示:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
如果有人知道怎么做,请告诉我。提前致谢!
长话短说,回答您的问题:不,仅使用 HTML 无法获得 url,您需要使用客户端或服务器端语言。
例如,在 javascript 中,您可以这样做来获取以前的 url、
document.referrer
这实际上是您的场景的理想选择,因为如果您通过 link 到达当前页面(而不是通过书签或在地址栏中键入).
如果用户尝试访问不可用的页面,he/she 将移至自定义 404.html。
我想知道是否可以仅使用 HTML 从自定义 404.html 访问原始请求的 URL?我没有使用 PhP 或任何其他辅助技术。
我的代码如下所示:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
如果有人知道怎么做,请告诉我。提前致谢!
长话短说,回答您的问题:不,仅使用 HTML 无法获得 url,您需要使用客户端或服务器端语言。
例如,在 javascript 中,您可以这样做来获取以前的 url、
document.referrer
这实际上是您的场景的理想选择,因为如果您通过 link 到达当前页面(而不是通过书签或在地址栏中键入).