In a web page opened in Safari on iOS, when a button on the page is clicked, if the user has installed a specific application A, then open application A, otherwise jump to the download page of application A in the AppStore, online The search result is to use ifame. When the click action occurs, the src of the iframe is set to the URL Schemes preset in application A. However, after actual operation, I found that even if application A is installed on the iPhone, the application cannot be invoked using iframe. A, does anyone know why this is? ? Is it related to the iOS system version? ps: The iPhone system version I am using is 10.3.2
The following is the js code that uses iframe to invoke the iOS application:
var ifr = document.createElement('iframe');
ifr.src = scheme_IOS; //Apply the URL Scheme defined in A
ifr.style.display = 'none';
document.body.appendChild(ifr);
setTimeout(function() {
document.body.removeChild(ifr);
}, 2000);
For ios9 and above, just use window.location.href = scheme_IOS.
Universal Link is recommended for ios9 and above