ryanseddon / react-frame-component

Render your React app to an iFrame
http://ryanseddon.github.io/react-frame-component/
MIT License
1.75k stars 156 forks source link

srcdoc attribute in mobile WebView #238

Open vadym-gyant opened 1 year ago

vadym-gyant commented 1 year ago

When the iframe is created it has initial content that is converted into a srcdoc attribute. As far as I understood, it serves as a mount point for content inside. When such iframe is used inside of the mobile app webview (ReactNative for example), it throws an error. I think that the main issue is that WebView can't handle the srcdoc in iframes.

Is there a way to remove scrdoc attribute?

ryanseddon commented 1 year ago

v5 was the big shift to srcdoc to move away from the legacy doc.write method due to performance issues, csp and other things.

I'm surprised it throws an error in a webview considering it is the same browser engine. Do you have the stack trace for the error you're getting?

In the meantime you can use v4.x.x which doesn't use srcdoc.