简体   繁体   中英

Apache Cordova Visual Studio 2015 iframe

IFrame does not work at all. IFrame loads only the HTML, HEAD and BODY tags like here:

<html>
  <head></head>
  <body></body>
</html>

//iframe is called in index.html
<iframe src="http://whatever.com" style="height:100%; width:100%;"></iframe>

InAppBrowser and other stuff is working.

How to do it correctly?

Why does IFrame not work?

I finally did it! So solution for my IFrame.

HTML HEAD:

<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">

IFrame:

<iframe src="http://somewebsite.com" sandbox="allow-same-origin allow-scripts allow-popups allow-forms" id="activityFrame" style="width:100%; height:100%;" frameborder="0"></iframe>

config.xml:

<access origin="*" />
<access origin="http://somewebsite.com" /> //OR you can add it to Visual studio Dialog
<preference name="websecurity" value="disable" />

And everything should work well.

I hope it help someone else. :)

I use this and works fine for both ios and android "with scrolling enabled"

<div style="width:100%;height:100%;overflow:scroll !important;-webkit-overflow-scrolling:touch !important">
  <iframe src="http://whatever.com" scrolling="yes" style="width:100%;height:100%" frameborder="0"></iframe>
</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM