0

I have make build using cordova platform add [email protected] version but getting error when run on iphone device

I am trying to my web in iFrame and iFrame host in cordova app. (web framework is DNN(https://www.dnnsoftware.com))

Errors :

Sandbox access violation: Blocked a frame at "file://" from accessing a frame at "https://link1.site.com". The frame being accessed is sandboxed and lacks the "allow-same-origin" flag.

Refused to load https://link1.site.com/m/login.aspx?ReturnUrl=https://link1.site.com/m/Login.aspx because it does not appear in the frame-ancestors directive of the Content Security Policy.

SecurityError: Sandbox access violation: Blocked a frame at "file://" from accessing a cross-origin frame. The frame being accessed is sandboxed and lacks the "allow-same-origin" flag.

Used Version for Build

Cordova version : 12.0.0

cordova platform add [email protected] (For build command)

Xcode version : 26.0.1

Cocoapods version : 1.16.2

Node version : 20.19.5

HTML Code:

<iframe id="webiFrame" src="https://link1.site.com" sandbox="allow-same-origin allow-scripts allow-forms allow-popups" target="_parent" width="700" height="500"></iframe>

Cordova Config.xml File settings:

<preference name="AndroidInsecureFileModeEnabled" value="true" />
<access origin="*" />
 <allow-intent href="http://*/*" />
  <allow-intent href="https://*/*" />
  <allow-intent href="geo:*" />
  <platform name="android">
    <allow-intent href="market:*" />
  </platform>
  <allow-navigation href="*" />
  <platform name="ios">
    <preference name="AllowUniversalAccessFromFileURLs" value="true" />
    <preference name="AllowFileAccessFromFileURLs" value="true" />
  </platform>

DNN web(web config) settings:

<add name="Content-Security-Policy"
     value="frame-ancestors 'self' http://link1.site.com https://link1.site.com http://localhost:* file:// gap: capacitor://localhost;" />

Please tell me where is the problem and how to fix it?

Thank you

1
  • you might try removing the sandbox attribute, but "file://" will have an opaque origin which won't match any other origin. Commented Oct 17 at 18:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.