简体   繁体   English

自动“返回”到上一个网址

[英]Automatic “go back” to previous url

I want to get redirect to the previous URL I was on. 我想重定向到我以前所在的URL。

I used this <meta http-equiv="refresh" content="2; url=javascript:history.back();"> but it doesnt work it gives me this error: 我使用了这个<meta http-equiv="refresh" content="2; url=javascript:history.back();">但是它不起作用,它给了我这个错误:

redirectrequireditems.html:14 Refused to refresh http://localhost/Test.com/redirectrequireditems.html to a javascript: URL

Line 14 is <meta http-equiv="refresh" content="2; url=javascript:history.back();"> 第14行是<meta http-equiv="refresh" content="2; url=javascript:history.back();">

Any suggestions? 有什么建议么?

Don't know if we can do it through META tag, I have the following solution using JavaScript: 不知道我们是否可以通过META标签做到这一点,我有以下使用JavaScript的解决方案:

<script language="JavaScript" type="text/javascript">
        setTimeout("window.history.go(-1)",2000);
</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM