admin管理员组文章数量:1327985
i'm just working on an application. After i started last week i added a few pages. Today i tried to implement the backbutton and i lose my head... four hours now i tried to get it working but i'm not able to because there are some strange behaviours in iOS 9.
So my hardware setup for better understanding:
- Mac Mini - OS X - Yosemite 10.10.5
- iPhone 6S - iOS 9.0.1 (13A405)
- iPhone 6+ - iOS 9.0 BETA (13A4305g)
- iPhone 5 - iOS 9.0 (13A344)
- iPad 4 - iOS 8.3 (12F69)
My application setup for better understanding:
- Cordova at version 5.3.3
- Cordova platform iOS at version 3.9.1
- jQuery at 2.1.4 minified
- jQuery mobile at 1.4.5 minified
The problem
So i want to implement a back button inside my application via jQuery. Normaly the way would be to add a href
with attributes like data-rel="back"
and data-transition="reverse"
. So my code looks like this:
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css">
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.structure-1.4.5.min.css">
<script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.4.5.min.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<title>Hello World</title>
</head>
<body>
<div data-role="page" id="page1">
This is page 1<br />
<br />
<a href="#page2" data-transition="slide">
Go to page 2
</a>
</div>
<div data-role="page" id="page2">
This is page 2<br />
<br />
<a href="#" data-rel="back" data-transition="reverse">
Go back to page 1
</a>
</div>
</body>
</html>
The back button is not working in iOS 9 and iOS 9.0.1. In iOS 8.3 everything works fine. So is there anything known about this issue? Someone heard about it? Or am i totaly wrong and did something the wrong way? As i'm not able to test it on android it would be great if someone could do this.
Waiting for your feedback now... Thanks in advance!
i'm just working on an application. After i started last week i added a few pages. Today i tried to implement the backbutton and i lose my head... four hours now i tried to get it working but i'm not able to because there are some strange behaviours in iOS 9.
So my hardware setup for better understanding:
- Mac Mini - OS X - Yosemite 10.10.5
- iPhone 6S - iOS 9.0.1 (13A405)
- iPhone 6+ - iOS 9.0 BETA (13A4305g)
- iPhone 5 - iOS 9.0 (13A344)
- iPad 4 - iOS 8.3 (12F69)
My application setup for better understanding:
- Cordova at version 5.3.3
- Cordova platform iOS at version 3.9.1
- jQuery at 2.1.4 minified
- jQuery mobile at 1.4.5 minified
The problem
So i want to implement a back button inside my application via jQuery. Normaly the way would be to add a href
with attributes like data-rel="back"
and data-transition="reverse"
. So my code looks like this:
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css">
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.structure-1.4.5.min.css">
<script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.4.5.min.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<title>Hello World</title>
</head>
<body>
<div data-role="page" id="page1">
This is page 1<br />
<br />
<a href="#page2" data-transition="slide">
Go to page 2
</a>
</div>
<div data-role="page" id="page2">
This is page 2<br />
<br />
<a href="#" data-rel="back" data-transition="reverse">
Go back to page 1
</a>
</div>
</body>
</html>
The back button is not working in iOS 9 and iOS 9.0.1. In iOS 8.3 everything works fine. So is there anything known about this issue? Someone heard about it? Or am i totaly wrong and did something the wrong way? As i'm not able to test it on android it would be great if someone could do this.
http://codepen.io/anon/pen/vNyrgB
Waiting for your feedback now... Thanks in advance!
Share Improve this question asked Sep 28, 2015 at 9:58 SithysSithys 3,8038 gold badges36 silver badges68 bronze badges 2- see this related question stackoverflow./questions/32807903/… – jcesarmobile Commented Sep 28, 2015 at 14:03
- this one might help too stackoverflow./questions/32761206/… – jcesarmobile Commented Sep 28, 2015 at 14:14
2 Answers
Reset to default 6There are many issues at the moment, but if it's about back button navigation and page flicker the fix is simple:
$.mobile.hashListeningEnabled=false;
Place that in your device ready event.
Take into account though that this breaks the Android back button so you should actually only conditionally apply this when your app is also supposed to run on Android. Something like:
if ( device.platform === "iOS" ) {
$.mobile.hashListeningEnabled=false;
}
1) iOS9 is broken in many places. 2) In addition, over the weekend Phonegap Build made an unannounced upgrade to the default build.
Here is what you need to know, but there is more that I do not have here.
1. iOS9 is now supported.
As of Nov 2, 2015, iOS 9 is supported by Cordova
Apache Cordova iOS 3.9.2
http://cordova.apache/announcements/2015/11/02/cordova-ios-3-9-2.html
## 1. No support for iOS9 YET! ##
PhoneGap Build iOS 9 Support Status
- Sept 23, 2015
- http://munity.phonegap./nitobi/topics/phonegap-build-ios-9-support-status
- Top line: iOS 9 is not officially supported until Cordova-iOS 4.0.0, which the Cordova team is hard at work on. However some issues can be solved with some simple configuration changes.
At this point in time, 4 bugs are reported to the Cordova Bug repository. Your issue does not appear in the respository - as of this date.
- 4 bugs - https://issues.apache/jira/browse/CB-9684?jql=text%20~%20%22iOS9%22
1 bug - https://openradar.appspot./22186109
Regardless, of what you are using, as the forum post states iOS 9 is not officially supported until Cordova-iOS 4.0.0. This means, create a work around, or wait until it is officially supported. OR file a bug report with cordova. OR wait until someone else creates a work around.
Sometimes Phonegap makes announcements on the forum and not the blog.
For more: (Official) Messages from Phonegap Build Technical Support in the Forum
2. Not setting piler version
From the Phonegap Build Forum, Petra Adds:
I would add: without announcement, PGB changed the default PGB-version from 3.7.0 to cli-5.2.0. This causes all those who have not set 'phonegap-version' in config.xml to be confronted with the sudden need of splashscreen and whitelist plugins and additional whitelisting specifications in config and html.
Also, several plugins seem not to build correctly with cli-5.2.0, causing log file error messages about "Class ***.java".
FWIW: Phonegap Build admitted to as much in this tweet
From Top Mistakes by Developers new to Cordova/Phonegap you have hit:
- #6 Not setting the "phonegap version" for your piler
- #7 Not setting "version" for you plugins
- #10 Not adding the new "white-list" and "white-list plugin" parameters in config.xml.
For #6 & #7
With the CLI version, if you do not assign a version for your platform OR in ''Phonegap Build'' if you do not set the phonegap-version in config.xml, YOU WILL GET THE LATEST VERSION. If you are lucky, your program just works as expected. If you are not lucky, you'll get a set of cascading error.
Luckily for all of us, Holly Schinsky has written a nice blog post to explain it all:
Cordova/PhoneGap Version Confusion
http://devgirl/2014/11/07/cordovaphonegap-version-confusion/
For #10
This relatively * NEW * requirement means – to access ANY website or resources on the web, you MUST use the whitelist and the whitelist plugin. This requirement goes into affect, if you are using [email protected] or better; including cli-5.1.1. If however, your version is before 4.0.0, let use say 3.5.0 or 3.7.0, then you will not have to add the white-list requirement.
To be clear, the "whitelist" has been around for a bit, but the plugin and requirement is very new. As you would expect, when the "whitelist" was added, the defacto open-access feature was deprecated. Or said another way, the defacto open-access feature was planned and scheduled to be eliminated. This change marks a step in removal of the open-access feature.
In addition, the Content Security Policy (CSP) has caught numerous developers - because it was soooo poorly publicized. This CSP needs to go in every single HTML page you used, just like you have to wait for 'deviceready'. The documentation is buried in the bottom of many of the latest documentation pages.
Related Links
Phonegap Build Forum: Notes for upgrading to cli-5.1.1 on PGB and now required Whitelist
- Cordova Whitelist Guide
- Phonegap Whitelist Guide
- Phonegap Build Whitelist Guide
本文标签: javascriptjQueryCordova history issueiOS 9 history brokenStack Overflow
版权声明:本文标题:javascript - jQueryCordova history issue - iOS 9 history broken? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742250134a2440596.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论