0
試圖利用ChildBrowser插件黑莓的時候我不斷收到在Chrome開發者工具這種錯誤方法「showWebPage」:類型錯誤:無法調用未定義的PhoneGap ChildBrowser黑莓插件:不能調用未定義
法「showWebPage」在螢火蟲中,我得到:TypeError:cordova.exec不是函數
「showWebPage」,[url,options]);
這裏是我的代碼
的index.html
<!DOCTYPE html>
<html>
<head>
<title>Share QR</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="jquery.mobile-1.2.0.min.css" />
<script src="cordova.js"></script>
<script type="text/javascript" charset="utf-8" src="childbrowser.js"></script>
<script src="jquery.js"></script>
<script src="jquery.mobile-1.2.0.min.js"></script>
<script src="main.js"></script>
<script src="details.js"></script>
</head>
<body id="main" >
<div data-role="page" id="home" data-position="fixed">
<div data-role="header">
<h1>Home</h1>
</div>
<div data-role="content">
<ul data-role="listview" data-filter="true" id="listItem"></ul>
</div>
<div data-role="footer">
<div data-role="navbar">
<ul>
<li><a href="#home" data-icon="grid">Feeds</a></li>
<li><a href="#videos" data-icon="plus">Videos</a></li>
</ul>
</div><!-- /navbar -->
</div>
</div>
<div data-role="page" id="videos" data-position="fixed" data-add-back-btn="true">
<div data-role="header">
<h1>Home</h1>
</div>
<div data-role="content">
<ul data-role="listview" data-filter="true" id="listItemvid"></ul>
</div>
<div data-role="footer">
<div data-role="navbar">
<ul>
<li><a href="#home" data-icon="grid">Feeds</a></li>
<li><a href="#videos" data-icon="plus">Videos</a></li>
</ul>
</div><!-- /navbar -->
</div>
</div>
</body>
</html>
main.js
var serviceURL = 'http://localhost/feeds/services/';
function onDeviceReady() {
// Now safe to use the PhoneGap API
alert("Ready");
}
$(document).bind('pageinit', function(){
$('#listItem li').remove();
document.addEventListener("deviceready", onDeviceReady, false);
$.getJSON(serviceURL + 'getdata.php', function(data){
$.each(data, function(index, value){
var output = '';
output += '<li><a href="details.html?id=' + value.id + '"><img src="pics/' + value.id + '.jpg"/>' + value.name + '</a></li>';
$("#listItem").append(output).listview("refresh");
});
});
});
$('#videos').live('pageshow', function(event) {
$('#listItemvid li').remove();
$.getJSON(serviceURL + 'getdata.php', function(data){
$.each(data, function(index, value){
var output = '';
output += '<li><img src="pics/' + value.id + '.jpg"/>' + value.name + '</a></li>';
$("#listItemvid").append(output).listview("refresh");
});
});
});
$('#listItemvid').live('vclick', function(event) {
event.preventDefault();
// alert("i'm running!");
if(window.cordova){
alert("loaded");
var cb = window.plugins.childBrowser;
cb.showWebPage('http://www.google.com',
{ showLocationBar: true });}
else{
alert("Not Available");
}
});
plugin.xml
<plugins>
<plugin name="App" value="org.apache.cordova.app.App"/>
<plugin name="Device" value="org.apache.cordova.device.Device"/>
<plugin name="Camera" value="org.apache.cordova.camera.Camera"/>
<plugin name="NetworkStatus" value="org.apache.cordova.network.Network"/>
<plugin name="Notification" value="org.apache.cordova.notification.Notification"/>
<plugin name="Accelerometer" value="org.apache.cordova.accelerometer.Accelerometer"/>
<plugin name="Geolocation" value="org.apache.cordova.geolocation.Geolocation"/>
<plugin name="File" value="org.apache.cordova.file.FileManager"/>
<plugin name="FileTransfer" value="org.apache.cordova.http.FileTransfer"/>
<plugin name="Contacts" value="org.apache.cordova.pim.Contact"/>
<plugin name="Capture" value="org.apache.cordova.capture.MediaCapture"/>
<plugin name="Battery" value="org.apache.cordova.battery.Battery"/>
<plugin name="Media" value="org.apache.cordova.media.Media"/>
<plugin name="ChildBrowser" value="org.apache.cordova.plugins.childbrowser.ChildBrowser"/>
</plugins>
config.xml
I included
<gap:plugin name="ChildBrowser" src="org.apache.cordova.plugins.childbrowser.ChildBrowser" version="~3" />
我搜索谷歌尋求幫助,但大家似乎有問題reolved但他們的步驟沒有解決我的問題。
任何幫助,將不勝感激
你究竟想要做什麼。 – Uchenna
我正在嘗試使用phonegap插件:childbrowser,我實際上已經遵守dat錯誤來了frm文件childBrowser.js類正試圖調用d原生java childBrowser.java類中的副本。 – kolexinfos