2015-03-19 60 views
0

我想問一下在瀏覽器應用程序中啓動外部網址時發生的問題。如何啓動外部網址(intel-xdk)

這裏是我的代碼(在英特爾XDK)

<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=no"> 

    <link rel="stylesheet" href="css/app.css"> 

<!-- IMPORTANT: Do not include a weinre script tag as part of your release builds! --> 
<!-- Place your remote debugging (weinre) script URL from the Test tab here, if it does not work below --> 
<!-- <script src="http://debug-software.intel.com/target/target-script-min.js#insertabiglongfunkynumberfromthexdkstesttab"></script> --> 

<!-- Recommended location for your JavaScript libraries --> 
<!-- These library references (below) are just examples to give you the general idea... --> 
    <!-- <script src="lib/mc/hammer.js"></script> --> 
    <!-- <script src="lib/ft/fastclick.js"></script> --> 


    <script src="cordova.js" id="xdkJScordova_"></script> 

    <script src="js/app.js"></script>   <!-- for your event code, see README and file comments for details --> 
    <script src="js/init-app.js"></script>  <!-- for your init code, see README and file comments for details --> 
    <script src="xdk/init-dev.js"></script>  <!-- normalizes device and document ready events, see file for details --> 
<script type="application/javascript"> 
    document.addEventListener("intel.xdk.device.ready",function(){ 
      intel.xdk.device.launchExternal("http://webagate.com/demos/alia/smarty-mobile-tablet-website-template/new-1/");  
},false); 

    </script> 
    </head> 


<body> 

    <!-- <script src="http://debug-software.intel.com/target/target-script-min.js#insertabiglongfunkynumberfromthexdkstesttab"></script> --> 
</body> 
</html> 
+0

嘗試修正了一些語法和格式inAppBrowser插件 – jcesarmobile 2015-03-19 10:04:31

+0

。刪除了最初的「歡迎屏幕」 – 2015-03-19 10:11:44

+0

我導入iframe和src =我的網址,在仿真器上工作,但在我的設備上出現錯誤網絡連接!任何幫助 – 2015-03-19 11:22:23

回答

0

英特爾XDK原住民正在貶值,而不是開始使用科爾多瓦的基礎之上。 選擇InAppBrowser插件並使用以下代碼獲取超鏈接。

<a href = '#' onclick=window.open('http://example.com','_blank','location=yes')> 

有關更多選項,請查看插件的文檔。

更新:

下面的代碼只需添加到您的app.js或自動生成index_user_scripts.js

(function() 
{ 
"use strict"; 
/* 
hook up event handlers 
*/ 
function register_event_handlers() 
{ 

window.open('http://example.com', '_blank'); 

} 
document.addEventListener("app.Ready", register_event_handlers, false); 
})(); 
+0

它出現一個白色的screan! ,現在我上傳了域名主機上的響應式設計,並希望在用戶打開.apk應用程序時打開它在應用程序瀏覽器中打開應用程序瀏覽器..在任何幫助PLZ :( – 2015-03-19 14:07:39

+0

檢查更新的答案。 – 2015-03-19 14:20:09

+0

謝謝你,它的工作原理,但與url欄!!我怎麼能隱藏這個出現在它的url域的吧!!再thnx :) – 2015-03-19 15:06:00