admin管理员组文章数量:1314556
I have a PHP page that has an error, but if I go back, it works fine. I can't redirect because the page can be accessed from two different places.
How can I make a JavaScript that loads automatically when the page loads?
Thanks, Sebastian
EDIT
that wouldn't work. is there a way to get the url of history.go(-2)?
thanks, Sebastian
I have a PHP page that has an error, but if I go back, it works fine. I can't redirect because the page can be accessed from two different places.
How can I make a JavaScript that loads automatically when the page loads?
Thanks, Sebastian
EDIT
that wouldn't work. is there a way to get the url of history.go(-2)?
thanks, Sebastian
Share Improve this question edited Oct 25, 2010 at 12:47 sebastian asked Oct 25, 2010 at 11:31 sebastiansebastian 1,5548 gold badges26 silver badges39 bronze badges 1- 3 I don't really understand. Wouldn't it be more sensible to fix the error in the first place? – Pekka Commented Oct 25, 2010 at 11:33
3 Answers
Reset to default 2...
<body onload="history.go(-1);">
...
The problem with using the window's onload property is that you do not want the user to wait for the current page to load. Just put this code/HTML at the top of the page right after the opening <head>
tag.
<script type="text/javascript">history.go(-1);</script>
You can use the window.history
object, like this:
history.back();
//or:
history.go(-1);
本文标签: phpHow can I go to historyback() when page loadsStack Overflow
版权声明:本文标题:php - How can I go to history.back() when page loads? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741967854a2407654.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论