gpt4 book ai didi

html - 对象/iframe 溢出滚动在 ios (cordova) 中不起作用

转载 作者:行者123 更新时间:2023-11-28 00:31:42 27 4
gpt4 key购买 nike

我正在使用 cordova 8.1.2 在 iframe/object 中加载我的页面。但滚动在 iPhone 中不起作用。

下面cordova中的config.xml内容

<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-navigation href="*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="*" />
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<preference name="android-targetSdkVersion" value="26" />
<preference name="loadUrlTimeoutValue" value="700000" />
<engine name="android" spec="^7.1.2" />
<engine name="ios" spec="^4.5.5" />

用于 iframe 的代码:

    <html lang="en" class="no-js">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; frame-src 'self'">
<meta name="viewport" content="user-scalable=no, initial-scale=1, minimum-scale=1, width=device-width" />
</head>
<body style="overflow:hidden; height:100%;">
<div style="overflow:scroll !important; -webkit-overflow-scrolling:touch !important;">
<iframe id="frame-one" data-tap-disabled="true" frameborder="0" src="my-url-website"></iframe>
</div>
</body>
</html>

用于对象标签的代码:

   <body style="overflow:hidden; height:100%;">
<div style="overflow:scroll !important; -webkit-overflow-scrolling:touch !important;">
<object id="previllew-frame" style="width:100%;height:100%" data="my-url-website"></object>
</div>
</body>

请帮帮我,谢谢。

最佳答案

我在 iOS 上为我正在处理的网络相关元素遇到了同样的问题。所以我很确定问题与 Safari/Webkit 相关。我还没有找到解决方案,但问题似乎与 Cordova 无关。尝试看看您是否可以弄清楚如何让您的代码在 Safari 中作为网页工作。

编辑:

好的,所以我找到的答案是,如果您为 iframe 设置 scrolling=no,那么错误就会消失。不幸的是,我正在处理的元素需要有一个滚动的 iframe,所以这对我来说是个问题,但我希望这个解决方案能有所帮助!

var iFrame = document.getElementById("iFrame");
iFrame.scrolling = "no";

关于html - 对象/iframe 溢出滚动在 ios (cordova) 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54380016/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com