iPhone 7 - iOS 10.3.2 - touchforcechanged event never fired in standalone mode
Closed this issue · 4 comments
Related Stack Overflow question:
https://stackoverflow.com/questions/45003908/iphone-7-ios-10-3-2-touchforcechange-event-never-fired
In shorts: as in the title: the 'touchforcechanged' event is never fired when a website saved to the springboard is launched in standalone mode :/
-> I first thought the issue was coming from your lib, but after re-implementing things myself without any polyfill, it seems it's iOS mobileSafari that bricks it .. or is it a feature ?
navigator.appVersion:
5.0 (iPhone; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.0 Mobile/14F89 Safari/602.1
Device is a [?year] [iPhone] [7]
Operating system is [iOS] [10.3.2]
Browser is [MobileSafari] [Mobile/14F89 Safari/602.1]
@stephaneAG thanks for reporting this. Sounds like an interesting bug. I will try to reproduce and see if there is anything more that we can find out about this issue.
😄
So I figured it out with a little bit of testing. So there are two conflicting web views on iOS right now. There is UIWebView and WKWebView. UIWebView is the older version and is being phased out. I have seen people run into this before and the old UIWebView does not support 3D Touch events.
I did a test to see if when saving you add a website to your home screen it will open in a UIWebView and sure enough:
(When added to the home screen)
(When opened in safari)
This was the code I used to test the page that I took from a stackoverflow on how to determine which web view a site is running in with js. https://stackoverflow.com/questions/28795476/detect-if-page-is-loaded-inside-wkwebview-in-javascript
<!doctype html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes" />
<script>
if (navigator.platform.substr(0,2) === 'iP'){
//iOS (iPhone, iPod or iPad)
var lte9 = /constructor/i.test(window.HTMLElement);
var nav = window.navigator, ua = nav.userAgent, idb = !!window.indexedDB;
if (ua.indexOf('Safari') !== -1 && ua.indexOf('Version') !== -1 && !nav.standalone){
//Safari (WKWebView/Nitro since 6+)
alert('Safari (WKWebView/Nitro since 6+)');
} else if ((!idb && lte9) || !window.statusbar.visible) {
//UIWebView
alert('UIWebView');
} else if ((window.webkit && window.webkit.messageHandlers) || !lte9 || idb){
//WKWebView
alert('WKWebView');
}
}
</script>
</head>
<body>
</body>
</html>
From what I understand Apple is phasing out the native looking pinned apps, only workaround I know would be to remove the <meta name="apple-mobile-web-app-capable" content="yes" />
line but then it would just open in Safari and not it's own "app".
Hope this helps! <3
Yeah all of this things have to do with it being in the old UIWebView and not the new WKWebView unfortunately. Closing for now as it is out of my control 😢