Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A few years ago I worked on a web-based augmented reality app intended to be shared by users through services that often displayed links in webviews. Newer SFSafariViewController worked fine but WKWebView failed silently in a way that was impossible to detect. There was no way to determine if you were in a WKWebView except: adding a hidden DOM node somewhere in the format “(123) 456-7890”, real safari would automatically turn it into a detectable phone number link, whereas WKWebView would not. With that ugly hack, we’d have to display a message asking the user to open in safari and hope the app had deigned to put a safari button somewhere.


> There was no way to determine if you were in a WKWebView except: adding a hidden DOM node somewhere in the format “(123) 456-7890”, real safari would automatically turn it into a detectable phone number link

What about non-US users? And doesn't Android's browser do the same thing?

Also, what happens if the page has `<a target="_blank">` or `window.open`? Does it always open in the same frame/window/target?


Last time I dug around into this, there was a delegate that's called that allows the app to open a new window/tab as makes sense for the app and display the link. I've seen applications that respond to this delegate by just forcing the existing WebView to open the link. If you don't implement the delegate, as I recall, nothing happens with these sort of links, they just appear dead to the user.


it does the same with phone numbers from other countries but if you hide it any phonenumber woud be fine.

perhaps important: it only changes the first instance on the page for me.

while this might work there is no reason linking phone numbers could not be made to work in embedded browsers.

after all, it is pretty dubious that customers wont be able to call you despite testing the contact page on a real phone




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: