Google 云端硬盘应该能够根据这篇博文提供 html:http://googleappsdeveloper.blogspot.nl/2012/11/announcing-google-drive-site-publishing.html
但是在我的帐户上,我只是在<pre></pre>
之间获取我的html代码。
我创建了一个带有测试 html 文件的测试文件夹:https://googledrive.com/host/0BxVNvXP_dI5QTEstTEtmMXNkOFU/
html 文件的内容:
<html>
<head>
<title>Test 123</title>
</head>
<body>
Test 123.
</body>
</html>
博客文章中的示例具有以下 HTTP 响应标头:
HTTP/1.1 200 OK
status: 200 OK
version: HTTP/1.1
cache-control: private, max-age=315360000
content-length: 1724
content-type: text/html
date: Thu, 29 Nov 2012 12:55:22 GMT
last-modified: Tue, 06 Nov 2012 23:57:41 GMT
server: HTTP Upload Server Built on Nov 21 2012 16:10:52 (1353543052)
我的页面具有以下 HTTP 响应标头:
HTTP/1.1 200 OK
status: 200 OK
version: HTTP/1.1
cache-control: private, max-age=315360000
content-length: 96
content-type: text/plain
date: Thu, 29 Nov 2012 12:51:00 GMT
last-modified: Thu, 29 Nov 2012 12:50:28 GMT
server: HTTP Upload Server Built on Nov 21 2012 16:10:52 (1353543052)
因此,区别在于content-type
标头。不知何故,我需要告诉谷歌云端硬盘我的html确实是一个html。文件。
文件的 MIME 类型是在上传时设置的。您是否上传了扩展名为.txt的文件并重命名了它?如果您删除并重新上传HTML文件,我敢打赌它会起作用。