Run html file from google cloud url(从谷歌云 url 运行 html 文件)
问题描述
I have saved my html file into google cloud storage with public read permission. When I am trying to open html file, Chrome automatically downloads the HTML files locally and does not open it in a browser tab.
Html public url is: https://www.googleapis.com/download/storage/v1/b/presentationpublish/o/index_1112q_252_636703629560463983.html?generation=1534766167109567&alt=media
code:
return storage.UploadObject(
bucket: BucketName,
objectName: objectName,
contentType: "text/html",
source: valStream,
options: new UploadObjectOptions { PredefinedAcl = publicRead }
);
I found the solution, we can change the current url with new like:
var url=https://www.googleapis.com/download/storage/v1/b/presentationpublish/o/index_1112q_252_636703629560463983.html?generation=1534766167109567&alt=media
var new_url=url.replace("https://www.googleapis.com/download/storage/v1/b/", "https://storage.googleapis.com/").replace("/o/", "/");
Now it's working fine for me.
这篇关于从谷歌云 url 运行 html 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从谷歌云 url 运行 html 文件
基础教程推荐
- 将 XML 转换为通用列表 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- rabbitmq 的 REST API 2022-01-01