我正在使用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