我正在使用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>
Run Code Online (Sandbox Code Playgroud)
Sim*_*ett 10
您正在将内容加载到主Web视图中的iframe中,这需要您允许访问config.xml文件中的该内容.
通过在config.xml中添加以下内容,您可以在加载iframe内容时允许主Web视图导航到您的URL,然后这样可以:
<allow-navigation href="http://dnsmarket.net/*" />
Run Code Online (Sandbox Code Playgroud)
我用iOS和Cordova 6.2.0对它进行了测试,它可以正常使用上述更改.我使用你的index.html发布了.
可以在此处找到描述如何配置允许导航的文档.
归档时间: |
|
查看次数: |
9204 次 |
最近记录: |