Hi, I've been using JQM+PhoneGap for years and love it; thank you!
Starting with iPhone OS 11.3, my app is broken with the following error:
SecurityError: Blocked attempt to use history.replaceState() to change session history URL from file:///var/containers/Bundle/Application/E73A3E4A-D961-4943-BAA3-7845E755F6A0/myplaceonline.app/www/index.html#/?phonegap=true to https://myplaceonline.com/?phonegap=true. Protocols, domains, ports, usernames, and passwords must match.
url:
file:///var/containers/Bundle/Application/E73A3E4A-D961-4943-BAA3-7845E755F6A0/myplaceonline.app/www/js/jquery.mobile-1.4.5.min.js
line #: 3 (31672)
The way I've always done it (and this continues to work with Android):
A JQM mobileinit event handler is attached which registers a pageloaded event handler which ultimately calls loadHomepage.
loadHomepage sets $.mobile.path.documentBase and the href attribute of the base tag to my remote server (https://myplaceonline.com/) and calls $.mobile.pageContainer.pagecontainer("change", "/", { allowSamePageTransition: true, transition: 'none', reloadPage: true, changeHash: true }); to load the remote homepage.
This ultimately drives JQM to call replaceState which fails with the security error:
The purpose of all of the above is so that I don't navigate away from file:/// because if I were to do that, I would lose access to all native phone JS APIs through PhoneGap. This works on older versions of iOS and continues to work on Android.
Any ideas on an alternative way to do this to get around the tighter security on newer versions of iOS? Alternatively, I see there are issues like https://github.com/jquery/jquery-mobile/issues/5465 which suggest a method of disabling history and I'm wondering if this would be another workaround and what I would lose?
Hi, I've been using JQM+PhoneGap for years and love it; thank you!
Starting with iPhone OS 11.3, my app is broken with the following error:
The way I've always done it (and this continues to work with Android):
mobileinit
event handler is attached which registers apageloaded
event handler which ultimately calls loadHomepage.$.mobile.path.documentBase
and thehref
attribute of thebase
tag to my remote server (https://myplaceonline.com/) and calls$.mobile.pageContainer.pagecontainer("change", "/", { allowSamePageTransition: true, transition: 'none', reloadPage: true, changeHash: true });
to load the remote homepage.The purpose of all of the above is so that I don't navigate away from
file:///
because if I were to do that, I would lose access to all native phone JS APIs through PhoneGap. This works on older versions of iOS and continues to work on Android.Any ideas on an alternative way to do this to get around the tighter security on newer versions of iOS? Alternatively, I see there are issues like https://github.com/jquery/jquery-mobile/issues/5465 which suggest a method of disabling history and I'm wondering if this would be another workaround and what I would lose?