我在NodeJS中編寫了一個簡單的文件服務器,通過Save To Drive按鈕提供HTML頁面。 HTML頁面在my_address:1337
處提供,並且要保存的文件在my_address:1338
處提供。點擊Save To Drive按鈕後,會顯示「正在開始下載」很長時間,然後顯示Failed Download. XHR Error
。保存到驅動器按鈕不起作用
我認爲這是由於該文件是從一個不同的端口服務的事實,所以我決定做同樣的appengine應用程序。頁面服務於http://sayodrive.appspot.com/index.html,文件服務於http://sayodrive.appspot.com/drivefile.jsp,我遇到了同樣的問題。
然後我決定做一個本地的Java Web應用程序:同樣的問題。然後,我嘗試將內容處置更改爲attachment
(強制下載),但也沒有奏效。
沮喪,我開始谷歌搜索,並遇到this page,聲稱保存到驅動器按鈕並不實際工作。 所以我回到official Google Drive SDK page,發現他們的示例按鈕不起作用。 這是一個噩夢嗎?
SOURCE:index.html的
<html>
<head>
<title>Test: Save To Drive</title>
<!-- -->
<link rel="canonical" href="http://sayodrive.appspot.com">
<script src="https://apis.google.com/js/plusone.js"></script>
</head>
<body>
<p>This must be the worst HTML you have ever seen :)</p>
<div class="g-savetodrive"
data-src="//http://sayodrive.appspot.com/drivefile.jsp"
data-filename="Test Drive"
data-sitename="Sayo Saves">
</div>
</body>
</html>
SOURCE:drivefile.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>DriveFile</title>
</head>
<body>
<%
java.io.Writer w = response.getWriter();
response.setContentType("text/plain");
w.write("If you're reading this in Drive, congrats!");
w.flush();
w.close();
%>
</body>
</html>
感謝您的報告,Google正在儘快調查此問題。 –
這裏的演示工作,https://googledrive.com/host/0BxSeRWWA9m3mcU4zSzFzREZScVk/buttonSimple.html –
Google正在單獨調查文檔按鈕。 –