WKWebview form filling with cross origin iframe

Hi everyone,

I’m working on an iOS app using WKWebView, and I have a specific use case involving cross-origin iframes and form autofill. I’m wondering if it’s possible to programmatically fill input elements, such as credit card numbers, within a cross-origin iframe loaded in a WKWebView.

I understand that due to the Same-Origin Policy, direct DOM manipulation of cross-origin iframes is restricted. However, I’m curious if there are any methods or workarounds that might allow me to achieve this, specifically within the context of WKWebView. Thanks.

Answered by Engineer in 804160022

There's no supported way for you to achieve this with the APIs currently available. If you'd like us to consider adding the necessary functionality, please file an enhancement request using Feedback Assistant. Once you file the request, please post the FB number here. If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?

There's no supported way for you to achieve this with the APIs currently available. If you'd like us to consider adding the necessary functionality, please file an enhancement request using Feedback Assistant. Once you file the request, please post the FB number here. If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?

I’m curious how certain password managers and autofill tools, such as RoboForm, are able to programmatically fill input fields like credit card numbers within cross-origin iframes. Additionally, the RoboForm browser seems capable of doing this without violating the Same-Origin Policy. Is there a specific API or workaround that these apps and browsers use to bypass the limitations imposed by the Same-Origin Policy, particularly within the context of WKWebView? Any insights into how this functionality is achieved would be greatly appreciated.

WKWebview form filling with cross origin iframe
 
 
Q