window.onload() 未在混合应用程序中触发
window.onload() is not firing in hybrid app
以下代码可以在我的 PC 上的浏览器中运行,但不能在我使用 cordova 构建的混合应用程序中运行。我正在使用棘轮框架。
<script type="text/javascript">
window.onload = function () {
document.getElementById('cy_username').value = localStorage.getItem('cy_username');
document.getElementById('cy_password').value = localStorage.getItem('cy_password');
document.getElementById('settingsForm').addEventListener('submit', onFormSubmit, false);
if (localStorage.getItem('cy_pushNotification') == "true") {
document.getElementById('cy_pushNotification').classList.add('active');
}
if (localStorage.getItem('cy_emailNotification') == "true") {
document.getElementById('cy_emailNotification').classList.add('active');
}
showInfoBox();
}
</script>
window.load仅适用于桌面浏览器,供混合应用使用,
document.addEventListener("deviceready", function() {
}, false);
以下代码可以在我的 PC 上的浏览器中运行,但不能在我使用 cordova 构建的混合应用程序中运行。我正在使用棘轮框架。
<script type="text/javascript">
window.onload = function () {
document.getElementById('cy_username').value = localStorage.getItem('cy_username');
document.getElementById('cy_password').value = localStorage.getItem('cy_password');
document.getElementById('settingsForm').addEventListener('submit', onFormSubmit, false);
if (localStorage.getItem('cy_pushNotification') == "true") {
document.getElementById('cy_pushNotification').classList.add('active');
}
if (localStorage.getItem('cy_emailNotification') == "true") {
document.getElementById('cy_emailNotification').classList.add('active');
}
showInfoBox();
}
</script>
window.load仅适用于桌面浏览器,供混合应用使用,
document.addEventListener("deviceready", function() {
}, false);