A web app that we’re developing is designed to be embedded into another website and there is a button on one of the screens that open either PlayStore or AppStore depending on the user platform. It works fine on Android but it doesn’t seem to work on iOS, nothing happens when the button is clicked.
We tried the same directly from the web app and it worked, so it seems that iframe is the issue
Here is the click handler function
const handleDownloadAppStore = () => {
window.location.href = 'https://apps.apple.com/no/app/idxxxxxxxx';
};
2
Answers
First, need to check your user agent as it iOS/iPad, for them url is different
put a condition over there it is iPad/iOS use below url
"https://itunes.apple.com/app/your-app-id"
It seems like you’re encountering an issue with opening the App Store on iOS devices when the button is clicked within an iframe. This behavior might be due to certain security restrictions and policies that browsers, especially on iOS, impose on iframes to prevent potentially malicious actions.
To work around this issue, you can try the following approaches:
This should navigate the parent window to the App Store URL and should work even within an iframe.
rel="noopener"
attribute to the anchor (<a>
) tag that wraps the button. This attribute helps prevent the newly opened page from having access to the window.opener object, which can sometimes cause security issues.Remember that cross-origin restrictions and security policies can sometimes lead to unexpected behavior, especially when working within iframes. If the above approaches still don’t work, consider reaching out to Apple’s documentation or support for specific guidelines on opening the App Store from within an iframe on iOS devices. Additionally, keep an eye on any iOS updates that might change the behavior or restrictions related to iframes.