I develop an app for Android with Sencha Touch and Phonegap (cordova-2.0.0).
I have an Ext.Panel with some HTML in it, For Instance:
<body>
<a href="MyPage.html">MyPage</a>
</body>
My Problem: When I run the app on device and tap the link, Android browser opens the URL and it quits the app.
My Aim: When I run the app on device and tap the link, the app should show the tapped link, For Instance:
navigator.notification.alert(MyPage.html);
My Phonegap code(shows the uniqueid.html in the HTMLPanel):
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onRequestFileSystemSuccess, null);
function onRequestFileSystemSuccess(fileSystem) {
fileSystem.root.getDirectory(Ext.ComponentQuery.query('#bibliothekDataView')[0].getSelection()[0].get('directory'), null, SelectedItemSuccess, SelectedItemFail);
}
//shows the uniqueid.html in the HTMLPanel
function SelectedItemSuccess(dir) {
dir.getFile(record.get('id') + '.html', null, gotFileEntry, fail);
}
function SelectedItemFail() {
navigator.notification.alert("Failed to read file contents: " + error.code);
}
function gotFileEntry(file) {
file.file(gotFile, fail);
}
function gotFile(file) {
readAsText(file);
}
function readAsText(file) {
var reader = new FileReader();
reader.onload = function (evt) {
Ext.ComponentQuery.query('#mainHTMLPanel')[0].setHtml(evt.target.result);
};
reader.onerror = function () {
navigator.notification.alert("Failed to read file!");
};
reader.readAsText(file);
}
function fail(error) {
navigator.notification.alert("Failed to read file contents: " + error.code);
}
My HTMLPanel (View):
Ext.define('myApp.view.HTMLPanel', {
extend: 'Ext.Panel',
xtype: 'mainhtmlpanel',
config: {
id: 'mainHTMLPanel',
scrollable: 'vertical',
}
});