我正在尝试在我的 phonegap 应用程序中打开 pdf 和 ppt 文件。我正在使用 phonegap 2.4 和最新版本的 WebIntent 插件。我按照 Webintent上的说明做了
但我仍然收到此错误:
参考错误:未定义 WebIntent
这是我的 html 头部分的一部分:
<script type="text/javascript" src="js/cordova-2.4.0.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.2.0.min.js"></script>
<script type="text/javascript" src="js/webintent.js"></script>
这是我的 config.xml 文件的一部分
<cordova>
...
<plugins>
...
<plugin name="Globalization" value="org.apache.cordova.Globalization"/>
<plugin name="InAppBrowser" value="org.apache.cordova.InAppBrowser"/>
<plugin name="WebIntent" value="com.borismus.webintent.WebIntent"/>
</plugins>
</cordova>
这是我使用插件的代码的js部分
function openFile(filePath){
window.plugins.webintent.StartActivity({
action: WebIntent.ACTION_VIEW,
url: filePath},
function(){},
function(){alert("failed to open file")}
);
}
其中 filePath 类似于“file:///mnt/sdcard/file.pdf”
请有人告诉我我做错了什么。PS:我对phonegap和eclipse很陌生。