window.history.go(-1)无法在iOS HomeScreen App中运行 [英] window.history.go(-1) not working in iOS HomeScreen App

查看:1603
本文介绍了window.history.go(-1)无法在iOS HomeScreen App中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我试图在iPhone HomeScreen应用程序中将用户重定向到历史记录中的一个级别,但它只是因为某些原因而没有触发。

So I'm trying to redirect the user back one level in the history on an iPhone HomeScreen App, but it's simply just not firing for some reason.

当前代码如下 window.history.go(-1)

我也试过各种其他版本 window.history.back() history.go(-1),但还没有运气。我无法解决如何实现pushState的问题,所以我还没有尝试过这种方法,但令人讨厌的是主屏幕应用程序的内容非常糟糕。

I've also tried various other version window.history.back(), history.go(-1), but no luck yet. I can't wrap my head around how to implement the pushState, so I haven't tried that approach yet, but it's quite annoying how incredibly bad the homescreen app stuff is made.

至少你可以用Safari进行调试。

Atleast you're able to debug with Safari.

推荐答案

你可以调试手机游戏,但不幸的是你需要一个mac 。

You can debug mobile safari, but unfortunately you need a mac.

如果没有,试试这个:


  1. 确保你的代码正常运行在桌面游猎中没有错误;

  2. 通过添加警报(history()调用)来检查您是否实际进行了呼叫代替历史记录(-1)代码;

  3. 是否在具有默认行为的链接中导航到另一个页面?如果是这样,在history()调用之后需要 event.preventDefault()或至少返回false;

  1. Make sure your code is working and no errors on desktop safari;
  2. Check if you are actually making the call by adding an alert("history() called") in place of the history(-1) code;
  3. Is it in a link that has a default behavour to navigate to another page? If so, you need a event.preventDefault() or at least a return false; after the history() call.

这篇关于window.history.go(-1)无法在iOS HomeScreen App中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆