I have added a web page to my home screen in iOS 13. The web page was loaded in iOS Safari via a data URL in this form: data:text/html;charset=UTF-8;base64, followed by the content of the web page in Base64 representation. I then added the web page to my home screen.
The web page's content is this, with the correct URL scheme in the anchor href:
if (window.navigator.standalone) {
var element = document.getElementById('redirect');
var event = document.createEvent('MouseEvents');
event.initEvent('click', true, true, document.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
setTimeout(function() {
element.dispatchEvent(event);
}, 25);
} else {
var p = document.createElement('p');
var node = document.createTextNode('SwiftRocks!');
p.appendChild(node);
document.body.appendChild(p);
}
<html>
<head>
<title>Apple Page</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="#ffffff">
<meta name="apple-mobile-web-app-title" content="Apple Page">
</head>
<body>
<a id="redirect" href="<url-scheme>"></a>
</body>
</html>
When I open the web page from my home screen, the URL scheme works properly, and the target app opens. But the back button text improperly displays "Untitled" instead of the name of the web page that was added to the home screen. How can I fix this?
I tested serving the web page from a web server on my development machine and the same issue happens. In that case, the URL was not a data URL. So I don't think this issue is due to loading the web page via a data URL.
This issue doesn't happen in iOS 12 and below.
This image shows the behavior on an iPhone XR.
More context about this solution of creating URL scheme shortcuts can be found at this article.
This solution is similar to what Facebook uses to let users add specific groups to their home screen, as described in this question.