点击链接打开Android浏览器并退出应用程序
我用Sencha Touch和Phonegap(cordova-2.0.0)为Android开发了一个应用程序 我有一个包含一些HTML的外部面板,例如:点击链接打开Android浏览器并退出应用程序,android,cordova,sencha-touch-2,Android,Cordova,Sencha Touch 2,我用Sencha Touch和Phonegap(cordova-2.0.0)为Android开发了一个应用程序 我有一个包含一些HTML的外部面板,例如: 我的问题是:当我在设备上运行应用程序并点击链接时,Android浏览器会打开URL并退出应用程序 我的目标:当我在设备上运行应用程序并点击链接时,应用程序应显示点击的链接,例如: navigator.notification.alert(MyPage.html) My Phonegap代码(在HTMLPanel中显示uniqueid.h
我的问题是:当我在设备上运行应用程序并点击链接时,Android浏览器会打开URL并退出应用程序
我的目标:当我在设备上运行应用程序并点击链接时,应用程序应显示点击的链接,例如:
navigator.notification.alert(MyPage.html)代码>
My Phonegap代码(在HTMLPanel中显示uniqueid.html):
window.requestFileSystem(LocalFileSystem.PERSISTENT,0,onRequestFileSystemSuccess,null);
函数onRequestFileSystemSuccess(文件系统){
fileSystem.root.getDirectory(Ext.ComponentQuery.query(“#bibliothekDataView”)[0]。getSelection()[0]。get('directory'),null,SelectedItemSuccess,SelectedItemFail);
}
//显示HTMLPanel中的uniqueid.html
函数SelectedItemSuccess(dir){
dir.getFile(record.get('id')+'.html',null,gotFileEntry,fail);
}
函数SelectedItemFail(){
navigator.notification.alert(“读取文件内容失败:+错误.code”);
}
函数gotFileEntry(文件){
file.file(gotFile,fail);
}
函数gotFile(文件){
readAsText(文件);
}
函数readAsText(文件){
var reader=new FileReader();
reader.onload=函数(evt){
Ext.ComponentQuery.query('#mainHTMLPanel')[0].setHtml(evt.target.result);
};
reader.onerror=函数(){
navigator.notification.alert(“读取文件失败!”);
};
reader.readAsText(文件);
}
功能失败(错误){
navigator.notification.alert(“读取文件内容失败:+错误.code”);
}
我的HTMLPanel(视图):
Ext.define('myApp.view.HTMLPanel'{
扩展:“Ext.Panel”,
xtype:'mainhtmlpanel',
配置:{
id:'mainHTMLPanel',
可滚动:“垂直”,
}
});
您是否可以控制外部面板中显示的HTML内容?如果是,则将
更改为
您需要注册一个意图,捕捉意图并打开应用程序。这似乎是我最简单的解决方案,THX