从谷歌驱动器打开 html

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11776324/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 02:01:43  来源:igfitidea点击:

opening html from google drive

htmlgoogle-drive-api

提问by Ane Hervías Caballero

I have made a page in html5 with css3. It works fine on local (I dont use any server, just doubleclick in the index to open it).
I want to put it in google drive. I have load all the documents needed, but when I try to open the html, I can only see the text (I mean, it is not being executing, I can see just the source code). Any suggestion?

我用 css3 在 html5 中创建了一个页面。它在本地运行良好(我不使用任何服务器,只需双击索引即可打开它)。
我想把它放在谷歌驱动器中。我已经加载了所有需要的文档,但是当我尝试打开 html 时,我只能看到文本(我的意思是,它没有被执行,我只能看到源代码)。有什么建议吗?

回答by Mahmoud Hboubati

Not available any more, https://support.google.com/drive/answer/2881970?hl=en

不再可用,https://support.google.com/drive/answer/2881970?hl=en

Host web pages with Google Drive

Note: This feature will not be available after August 31, 2016.

使用 Google Drive 托管网页

注意:此功能在 2016 年 8 月 31 日之后将不可用。

I highly recommend https://www.heroku.com/and https://www.netlify.com/

我强烈推荐https://www.heroku.com/https://www.netlify.com/

回答by Dev

  1. Create a new folder in Drive and share it as "Public on the web."
  2. Upload your content files to this folder.
  3. Right click on your folder and click on Details.
  4. Copy Hosting URL and paste it on your browser.(e.g. https://googledrive.com/host/0B716ywBKT84AcHZfMWgtNk5aeXM)
  5. It will launch index.html if it exist in your folder other wise list all files in your folder.
  1. 在云端硬盘中创建一个新文件夹并将其共享为“在网络上公开”。
  2. 将您的内容文件上传到此文件夹。
  3. 右键单击您的文件夹,然后单击详细信息。
  4. 复制托管 URL 并将其粘贴到您的浏览器上。(例如https://googledrive.com/host/0B716ywBKT84AcHZfMWgtNk5aeXM
  5. 如果它存在于您的文件夹中,它将启动 index.html 否则列出您文件夹中的所有文件。

回答by bigbearzhu

I don't think it is necessary to "host" the content using the way from the accepted answer. It is too complicated for a normal user with limited developing skills.

我认为没有必要使用已接受的答案中的方式“托管”内容。对于开发技能有限的普通用户来说太复杂了。

Google actually has provided hosting feature without using Drive SDK/API, what you need is just few clicks. Check this out:

Google 实际上提供了不使用 Drive SDK/API 的托管功能,您只需点击几下即可。看一下这个:

http://support.google.com/drive/bin/answer.py?hl=en&answer=2881970

http://support.google.com/drive/bin/answer.py?hl=zh-CN&answer=2881970

It is the same to the answer of user1557669. However, in step 4, the URL is not correct, it is like:

和user1557669的回答一样。但是,在第4步中,URL不正确,就像:

https://drive.google.com/#folders/...

https://drive.google.com/#folders/...

To get the correct host URL. Right click on the html file (you have to finish 1-3 steps first and put the html in the public shared folder), and select "Details" from the context menu. You will find the hosting URL right close to the bottom of the details panel. It should look like:

获取正确的主机 URL。右键单击 html 文件(您必须先完成 1-3 个步骤并将 html 放入公共共享文件夹中),然后从上下文菜单中选择“详细信息”。您会在详细信息面板底部附近找到托管 URL。它应该看起来像:

https://googledrive.com/host/.../abc.html

https://googledrive.com/host/.../abc.html

Then you can share the link to anyone. Happy sharing.

然后您可以将链接分享给任何人。快乐分享。

回答by Chris Grundy

A lot of the solutions offered here do not seem to work anymore. I'm currently on a chromebook and wanted to view an HTML5 banner. This seems impossible now through Google Drive or other apps (as mentioned in previous comments).

这里提供的许多解决方案似乎不再有效。我目前在 chromebook 上,想查看 HTML5 横幅。现在通过 Google Drive 或其他应用程序(如之前的评论中提到的)这似乎是不可能的。

The method I ended up using to view the HTML5 was the following:

我最终用来查看 HTML5 的方法如下:

  1. Open Google Adwords (create a free account if you dont have one)
  2. Click on Ads in the top panel
  3. Click on "+AD" and choose image ad
  4. Choose "upload an ad"
  5. Drag and drop your zip file into the area
  6. Click on Preview
  7. Voila, you will see your HTML5 banners in their full beauty
  1. 打开 Google Adwords(如果没有,请创建一个免费帐户)
  2. 点击顶部面板中的广告
  3. 点击“+AD”并选择图片广告
  4. 选择“上传广告”
  5. 将您的 zip 文件拖放到该区域
  6. 点击预览
  7. 瞧,您将看到您的 HTML5 横幅的全部美感

There may well an easier way, but this way is pretty good too. Hope it helps and worked well for me.

可能有更简单的方法,但这种方法也很好。希望它对我有帮助并且效果很好。

回答by ZAFAR007

Now you can use https://sites.google.com

现在您可以使用 https://sites.google.com

Build internal project hubs, team sites, public-facing websites, and more—all without designer, programmer, or IT help. With the new Google Sites, building websites is easy. Just drag content where you need it.

构建内部项目中心、团队网站、面向公众的网站等,无需设计师、程序员或 IT 帮助。借助新的 Google 协作平台,构建网站变得轻而易举。只需将内容拖到您需要的地方即可。

回答by RADXack

While drive allows you to edit plain text and HTML files I don't believe they allow the HTML to actually be displayed. I don't think they want people hosting websites from their drive space.

虽然驱动器允许您编辑纯文本和 HTML 文件,但我认为它们不允许实际显示 HTML。我认为他们不希望人们从他们的驱动器空间托管网站。

回答by user1557669

  1. Create a new folder in Drive and share it as "Public on the web."
  2. Upload your HTML, JS & CSS files to this folder.
  3. Open the HTML file & you will see "Preview" button in the toolbar.
  4. Share the URL that looks like www.googledrive.com/host/... from the preview window and anyone can view your web page.
  1. 在云端硬盘中创建一个新文件夹并将其共享为“在网络上公开”。
  2. 将您的 HTML、JS 和 CSS 文件上传到此文件夹。
  3. 打开 HTML 文件,您将在工具栏中看到“预览”按钮。
  4. 从预览窗口共享看起来像 www.googledrive.com/host/... 的 URL,任何人都可以查看您的网页。

回答by lowtech

Found method to see your own html file (from here (scroll down to answer from prac): https://productforums.google.com/forum/#!topic/drive/YY_fou2vo0A)

找到了查看您自己的 html 文件的方法(从这里(向下滚动到 prac 的回答):https: //productforums.google.com/forum/#!topic/drive/YY_fou2vo0A )

-- use Get Link to get URL with id=... substring -- put ucinstead of openin URL

-- 使用 Get Link 获取带有 id=... 子字符串的 URL --在 URL 中放置uc而不是open

回答by Jlearner

Steps:

脚步:

  1. Upload html file to the google drive and share it as "Public on the web" after uploading just make sure that the content of your html is not modified in the drive.
  2. Right click on the shared file and click on 'Get link' and save it to notepad it will look something like 'https://drive.google.com/open?id=0B55nkHvMDw18T3VaYjY3NEE4SEE'
  3. Take the code (about 28 character alphanumeric) after '=' sign from the above link and paste it after 'https://googledrive.com/host/' now 'https://googledrive.com/host/0B55nkHvMDw18T3VaYjY3NEE4SEE' is your actual sharable url link, open the html file from address bar of the browser using this url.
  1. 将 html 文件上传到谷歌驱动器并在上传后将其共享为“在网络上公开”,只需确保驱动器中未修改 html 的内容。
  2. 右键单击共享文件,然后单击“获取链接”并将其保存到记事本,它看起来类似于“ https://drive.google.com/open?id=0B55nkHvMDw18T3VaYjY3NEE4SEE
  3. 从上面的链接中获取“=”符号后的代码(大约 28 个字符的字母数字),然后将其粘贴到“ https://googledrive.com/host/”之后,现在“ https://googledrive.com/host/0B55nkHvMDw18T3VaYjY3NEE4SEE”就是你的实际可共享的 url 链接,使用此 url 从浏览器的地址栏中打开 html 文件。