问题是 - 当我输入带有 .png 或 .pdf 的 url 时,它已显示在 iframe 中>。我可以滚动它,阅读等。 但是当我插入一个包含 docx 或 xls 文件的 url(例如“http://www.exampleimage.docx”)时 - 它会自动通过浏览器加载,并且不会在 iframe 中显示>。但是我想像我一样在 iframe 中查看 .docx 文件的内容与pdf。 做什么或去哪里找人?
这是我的部分代码:
<iframe src={{attachmentUrl}} width="468" height="468" frameborder="0">
Click on attachment please.
</iframe>
最佳答案
您可以编辑您的网址,即 "https://docs.google.com/gview?url= ${YOUR_URL}&embedded=true"然后添加到 iframe:
<iframe
className="doc"
src={`https://docs.google.com/gview?url=${YOUR_URL}&embedded=true`}
/>
关于html - 为什么 .doc 会自动下载,但不会显示在 <iframe> 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37815767/