gpt4 book ai didi

cordova - PhoneGap Iframe 不工作

转载 作者:行者123 更新时间:2023-12-04 17:08:02 25 4
gpt4 key购买 nike

我正在使用 PhoneGap 开发一个应用程序我单独使用 iframe,我如何克服它不加载 iframe 字段

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
</head>
<body>

<div class="loader"></div>

<div class="iframe">
<iframe name="iframeName" width="320" height="480">></iframe>
</div>

<script type="text/javascript" src="js/jquery-3.0.0.min.js"></script>
<script type="text/javascript">
$("[name=iframeName]").attr("src", "http://dnsmarket.net/pdf");
</script>

</body>
</html>

最佳答案

您正在将内容加载到主 Web View 中的 iframe 中,这要求您允许访问 config.xml 文件中的内容。

通过在 config.xml 中添加以下内容,您可以在加载 iframe 内容时允许主 Web View 导航到您的 URL,然后就可以了:

<allow-navigation href="http://dnsmarket.net/*" />

我使用 iOS 和 Cordova 6.2.0 对此进行了测试,并且在上述更改中可以正常工作。我使用了您发布的 index.html。

描述如何配置允许导航的文档可以是 found here .

关于cordova - PhoneGap Iframe 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37970317/

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