Closed tanukki2929 closed 9 months ago
The short answer is that you'll need to use a custom scheme instead of file URLs.
The long answer is that what you're trying to do doesn't make sense with file URLs and is actually forbidden by the HTML specification: https://html.spec.whatwg.org/multipage/history.html#can-have-its-url-rewritten
WebKit changed their behaviour in iOS 16.4 to match Chrome and the HTML spec: https://github.com/WebKit/WebKit/commit/78a55cf3976ce0b4543df42b03c335c5b89d27dd
So it's fine to use pushState
with file:///
URLs to go from index.html
to index.html#/dashboard
, but it is not allowed to go from index.html
to index.html/dashboard
.
Maybe your framework has an option to use hash-based URLs for routing?
Thank you for your response. I appreciate it very much. We will see if we can address the issue based on your response.
The short answer is that you'll need to use a custom scheme instead of file URLs.
Hi @dpogue. Is the scheme option currently broken? I noticed this today: https://github.com/apache/cordova-ios/issues/1223#issuecomment-1608211672
It's not broken, I've just created a new app with cordova-ios 6.3.0 and it's working fine with a custom scheme.
@jcesarmobile it seems broken when the URL contains a query or a fragment, for instance. In this case, the resulting URL will be blank.
In that case, can you create a new issue and provide a sample app that reproduces that issue?
But for regular use case, it's working fine.
Running a Cordova app and ran across this same error in Xcode. I added this to my config.xml to set a custom URL scheme and it fixed the issue for me.
<preference name="scheme" value="app" />
<preference name="hostname" value="localhost" />
Hi, We are also having the same issue with our Cordova iOS app, our app is working on iOS 15 devices but when we run the same app on iOS 16.4 devices, the navigation from www/index.html to www/pages/ui/page1.html using $.mobile.changePage API is not working. Can any one suggest us how to fix this problem in cordova ios app with cordova-ios:6.3.0 or 7.0.0 versions with target SDK 16+
The original reporter reported this issue in the context of using the history API with file://
protocol and answer on that subject is: https://github.com/apache/cordova-ios/issues/1324#issuecomment-1542206012
Hi, We are also having the same issue with our Cordova iOS app, our app is working on iOS 15 devices but when we run the same app on iOS 16.4 devices, the navigation from www/index.html to www/pages/ui/page1.html using $.mobile.changePage API is not working. Can any one suggest us how to fix this problem in cordova ios app with cordova-ios:6.3.0 or 7.0.0 versions with target SDK 16+
As noted above, if $.mobile.changePage
is using the history API, then you either need to use schemes (see https://github.com/apache/cordova-ios/issues/1324#issuecomment-1613704842) or you need to use a hash-based routing. Without knowing what $.mobile.changePage
actually does we can't provide further insights.
Closing as not-a-bug.
Bug Report
Problem
What is expected to happen?
What does actually happen?
Routing error on iOS16 and above when building Angular app with Xcode14.3
The same problem reported in the APPLE forum below occurs. Please let us know if there is any way to solve this problem with Cordova. https://developer.apple.com/forums/thread/728157
Information
Command or Code
Environment, Platform, Device
Version information
Xcode バージョン 14.3 (14E222b) "cordova-ios": "^6.3.0"
Checklist