我正在使用Google Picker api访问我的谷歌驱动器文件夹的文件。下面的HTML页面使用选择器来加载我的谷歌文档。但是,在我选择文档并按下选择选项后,选取器对话框不会关闭。甚至当我按下iframe右上角的关闭按钮时也不行。我认为problrm是在选择回拨,但我不知道如何recitfy这一点。我在这里包含html页面。无法关闭Google Picker iframe
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Picker Example</title>
<!-- The standard Google Loader script. -->
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
// Use the Google Loader script to load the google.picker script.
// google.setOnLoadCallback(createPicker);
google.load('picker', '1');
// Create and render a Picker object for searching images.
function createPicker() {
var picker = new google.picker.PickerBuilder().
addView(google.picker.ViewId.DOCS).
setCallback(pickerCallback).
build();
picker.setVisible(true);
}
// A simple callback implementation.
function pickerCallback(data) {
var url = 'nothing';
if (data[google.picker.Response.ACTION] == google.picker.Action.PICKED) {
var doc = data[google.picker.Response.DOCUMENTS][0];
url = doc[google.picker.Document.URL];
}
var message = 'You picked: ' + url;
document.getElementById('result').innerHTML = message;
}
</script>
</head>
<body>
<div id="result">
<button onclick="createPicker()">Upload Files </button>
<iframe></iframe>
</div>
</body>
</html>
这不是问题其实....即使我托管在服务器上它没有工作...我张贴解决方案下面 – funtime