我收到标题中所述的错误。
这是html代码
<!DOCTYPE HTML>
<html>
<head>
<title> PhoneGap </title>
<script type="text/javascript" charset="utf-8" src="cordova-2.3.0.js"></script>
<script type="text/javascript" charset="utf-8" src="fileopener.js"></script>
</head>
<body>
<h1>PDF Open Tester</h1>
<a href="#" onclick="window.plugins.fileOpener.open("/sdcard/Course Content Files/1.pdf");">open</a>
</body>
</html>
这是fileopener.js
function FileOpener() {
};
FileOpener.prototype.open = function(url) {
cordova.exec(null, null, "FileOpener", "openFile", [url]);
};
if(!window.plugins) {
window.plugins = {};
}
if (!window.plugins.fileOpener) {
window.plugins.fileOpener = new FileOpener();
}
错误是什么?我的假设是错误不在cordova javascript文件中。
从评论编辑:
我也得到了进一步的错误
Uncaught TypeError: Cannot read property 'fileOpener' of undefined.