How to make an HTML back link?
What is the simplest way to create an <a>
tag that links to the previous web page? Basically a simulated back button, but an actual hyperlink. Client-side technologies only, please.
Edit
Looking for solutions that have the benefit of showing the URL of the page you're about to click on when hovering, like a normal, static hyperlink. I'd rather not have the user looking at history.go(-1)
when hovering on a hyperlink. Best I've found so far is:
<script>
document.write('<a href="' + document.referrer + '">Go Back</a>');
</script>
另一种方式:
<a href="javascript:history.back()">Go Back</a>
此解决方案的优势在于显示悬停时链接页面的网址,因为大多数浏览器默认使用该网址,而不是history.go(-1)
或类似网址:
<script>
document.write('<a href="' + document.referrer + '">Go Back</a>');
</script>
The easiest way is to use history.go(-1);
Try this:
<a href="#" onclick="history.go(-1)">Go Back</a>
链接地址: http://www.djcxy.com/p/6230.html
上一篇: 如何创建一个HTML按钮,就像链接到同一页上的项目一样?
下一篇: 如何制作HTML反向链接?