我正在開發PhoneGap構建中的測試應用程序。目前,我正在嘗試在應用加載時重定向到一個頁面。但是當我嘗試這樣做時,它不會重定向,而只能保留在index.html頁面中。我正在使用TestObject來測試應用程序。Phonegap構建 - Javascript無法正常工作
的index.html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" charset="utf-8">
function init() {
document.addEventListener("deviceready", onDeviceReady, true);
}
function onDeviceReady() {
alert("Device is ready");
}
</script>
</head>
<body onload="init();">
<input type="button" onclick="location.href='http://google.com';" value="Go to Google" />
Hai welcome to my app
</body>
</html>
config.xml中
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.mydomain.mobileApp"
versionCode = "1"
version = "1.0.0" >
<!-- versionCode is Android only -->
<!-- version is in major.minor.patch format -->
<name>My App</name>
<description>
An example for phonegap build app which wont show up in the playstore.
</description>
<author href="https://YourWebsite.com" email="[email protected]">
Name Of The Author
</author>
</widget>
當我測試這個瀏覽器,在單擊按鈕,它會重定向到http://google.com。但是當我上傳apk(從phonebuild構建)並上傳到TestObject時,按鈕即將到來。但點擊它沒有任何反應。當我測試應用程序時,我越來越喜歡這個。
誰能幫我找到這個問題。提前致謝。
http://phonegap.com/getstarted/請按照教程和嘗試指定你的問題。 –
你在使用phonegap-cli還是phonegap-app-desktop? –
@ HassanALi ..我使用phonegap build .. – Jenz