Javascript 在英特尔&x27;s XDK
我对使用Intel的XDK非常陌生,我已经有了一个需要转换为android应用程序的web应用程序。我已经彻底测试了HTMLWeb应用程序,到目前为止,它在浏览器中运行得非常好。问题是,当我将它导入XDK时,它在模拟器上似乎不起作用。我到处搜索,似乎没有其他人有同样的问题,所以一定是我遗漏了什么。我知道你必须插入一个额外的javascript(我已经插入了),但到目前为止,它仍然不起作用。这里有人能给我指一下正确的方向吗?先谢谢你 我的代码:Javascript 在英特尔&x27;s XDK,javascript,android,emulation,intel,intel-xdk,Javascript,Android,Emulation,Intel,Intel Xdk,我对使用Intel的XDK非常陌生,我已经有了一个需要转换为android应用程序的web应用程序。我已经彻底测试了HTMLWeb应用程序,到目前为止,它在浏览器中运行得非常好。问题是,当我将它导入XDK时,它在模拟器上似乎不起作用。我到处搜索,似乎没有其他人有同样的问题,所以一定是我遗漏了什么。我知道你必须插入一个额外的javascript(我已经插入了),但到目前为止,它仍然不起作用。这里有人能给我指一下正确的方向吗?先谢谢你 我的代码: <!DOCTYPE html> <
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width target-densitydpi=device-dpi initial- scale=0.1 maximum-scale=0.5 user-scalable=0" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge" />
<title>King</title>
<style>
html {
height:100%;
}
body {
background-color: #000000;
margin:0;
height:100%;
}
</style>
<meta name="viewport" content="user-scalable=yes, width=1024" />
<script src='intelxdk.js'></script>
<script type="text/javascript">
/* Intel native bridge is available */
var onDeviceReady=function(){
//hide splash screen
intel.xdk.device.hideSplashScreen();
};
document.addEventListener("intel.xdk.device.ready",onDeviceReady,false);
</script>
</head>
<body>
<div style ="margin:auto;width:1024px;height:768px">
<div id="king_hype_container" style="position:relative;overflow:hidden;width:1024px;height:768px;">
<script type="text/javascript" charset="utf-8" src="King.hyperesources/king_hype_generated_script.js?7046"></script>
</div>
</div>
</body>
</html>
国王
html{
身高:100%;
}
身体{
背景色:#000000;
保证金:0;
身高:100%;
}
/*“英特尔本机网桥”可用*/
var ondevicerady=函数(){
//隐藏启动屏幕
intel.xdk.device.hideSplashScreen();
};
document.addEventListener(“intel.xdk.device.ready”,ondevicerady,false);
也许我在javascript中将intel xdk放错位置了?它可能没有加载king\u hype\u生成的\u script.js。您可以通过在模拟器中弹出调试器看到这一点。您可以通过单击屏幕左上角的bug图标,然后查看console选项卡中的消息来完成此操作。您可能希望将king_hype_generate_script.js作为静态文件复制到项目中,或者使用指向服务器的绝对URL。将其复制到项目中将使您能够更好地脱机工作 按照@rscohn2的建议去做(让“king”脚本成为你项目的本地脚本,尽可能避免通过网络加载),但也看看我给那些试图将web应用程序转变为webview应用程序的人提供的内容。有很多注释和console.log消息可以帮助您了解发生了什么,但本质上:
- 等待自定义“app.Ready”事件启动您的应用程序
- 在加载第三方和自定义JS脚本时请考虑(请参阅自述)