1

我有一个启用了 javascript 的 webview,我正在尝试使用 google docs view url 显示 pdf、docs 等。问题是 webview 正在呈现 html 而不是 doc。我应该提到,这也发生在我的 Dropbox 帐户中指向 pdf 或 doc 的 url 上。

string pdf = "https://docs.google.com/document/d/1SGFAxaYSA2wBvKCKL89rYG4yEZIJVIJ2lY-1G7IF6g4/edit?usp=sharing";
webViewcontent.LoadUrl("https://docs.google.com/gview?embedded=true&url=" + pdf);

这是显示的内容: 在此处输入图像描述

4

2 回答 2

1

我认为您正在寻找的网址是...

 string url = "https://docs.google.com/document/d/1SGFAxaYSA2wBvKCKL89rYG4yEZIJVIJ2lY-1G7IF6g4/edit?usp=sharing";
 string myUrl = string.Format("https://docs.google.com/viewer?url={0}", url);
 webViewcontent.LoadUrl(myUrl);

这将在用户没有谷歌帐户的情况下工作。

但是,由于您的网址使用的是 https,因此可能需要身份验证。

于 2013-10-09T08:53:09.417 回答
0
string pdf = "https://docs.google.com/document/d/1SGFAxaYSA2wBvKCKL89rYG4yEZIJVIJ2lY-1G7IF6g4/edit?usp=sharing";
webViewcontent.LoadUrl("https://docs.google.com/gview?embedded=true&url=" + pdf);

最终的 url 将是https://docs.google.com/gview?embedded=true&url=**https://docs.google.com/document/d/**1SGFAxaYSA2wBvKCKL89rYG4yEZIJVIJ2lY-1G7IF6g4/edit?usp=sharing,我认为您想删除除文档 ID 之外的所有内容。

于 2013-10-01T00:38:49.733 回答