I am developing a hybrid app with html5 cordova. I have 3 html pages. I use localStorage and SQLite Plugin. I navigate between those pages. But, when I move from one page to another, cordova features become useless.
my login.html page:
Document.addEventListener("deviceready",onDeviceReady,false);
function onDeviceReady() {
var db = window.sqlitePlugin.openDatabase({
name : "OZEGE",
bgType : 1
});
//some transactions
}
function Login(){
// my login authorization
}
and after the authorization, I move my other page with this code line;
window.location = "experInfos.html";
experInfos.html:`
document.addEventListener("deviceready",onDeviceReady,false);
function onDeviceReady() {
document.getElementById("devamButonu").disabled = true;
var db = window.sqlitePlugin.openDatabase({
name : "OZEGE",
bgType : 1
});
//populate dropdown
populateMensei(db);
}
`
when the second page opens, console shows;
deviceready has not fired after 5 seconds. (01:40:11:905)
at www/cordova.js:1154
I couldnt populate my drop down list. it shows:
SQLitePlugin openargs: {"name":"OZEGE","bgType":1} (02:08:08:610)
at file:///android_asset/www/plugins/org.pgsqlite/www/SQLitePlugin.js:8
but nothing happens. Why cannot I use device ready on second page ? Because of the config.xml ?
I change the way of navigation. I put all the html files in one page and I just change the visibility of views. It works and there is no problem with this situation now
Something else I found, try adding a sdcard to your emulator
I found my initial error was the file plugin was not being allowed to access a file space, this was because it didn't exist in the emulator, I added an external card to the emulator definition and hey presto it worked
I managed to get navigation to work by concatenating all my stylesheets to a single file, so I'm guessing this has to do with load time or number of file requests etc. in the page you are navigating to. @amenthes I hope that works for you too.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.