2016-06-22 40 views
4

我正在開發與PhoneGap的應用程序,我獨自使用iframe,我怎麼克服它不會加載iframe字段的PhoneGap的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> 

回答

9

您加載內容到主Web視圖的iframe ,這要求您允許訪問config.xml文件中的內容。

通過添加config.xml中的下面,你讓主Web視圖加載iframe的內容時,瀏覽到您的網址,而這個作品,然後:

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

我與iOS和科爾多瓦6.2測試這.0它可以很好地適應上述變化。我用你的index.html發佈。

描述如何配置允許導航的文檔可以是found here

+0

我試過所有進程允許PhoneGap版本v0.3.3 iframe在運行之前被阻塞現在不起作用 –

+0

您的意思是您使用PhoneGap桌面應用程序嗎? –