douxie9471 2015-06-25 06:56
浏览 375
已采纳

PHP / Javascript:History.go(-1)无效,浏览器返回DOES

I changed something between last night and this morning and now my back buttons are not working.

I have used

<button type="submit" onClick="history.go(-1)">Back</button>

without a problem up until this morning. Now, when this button is clicked, the previous URL is loaded, but my PHP $_SESSION is not, cause me to be redirected to my login page.

If I use the browsers built-in back button, it loads without any problems.

This problem persists in both FireFox 38.0.5 and IE 11.

I have tried history.go(-1), history.back and a few others and there is something wrong with the JS.

Any ideas what to look out for? I am by no means a JS expert (this is about as much as I do) and my site has virtually no JS in it to begin with.

I'd love to give more code examples, but as I haven't the faintest idea where the problem is, I would only be able to upload my entire system...

Thanks in advanced.

  • 写回答

3条回答 默认 最新

  • douzhuijing4911 2015-06-25 07:05
    关注

    Thank you Vhortex and Hearner!!!

    I had accidentally made it type="submit" instead of type="button". So my code should be <button type="submit" onClick="history.go(-1)">Back</button>

    Is there any way to delete a post? This is embarrassing...(kidding)

    Happy Thursday!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 虚拟机打包apk出现错误
  • ¥30 最小化遗憾贪心算法上界
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝