【问题标题】:unable to show doc file using google docs api with iframe无法使用带有 iframe 的 google docs api 显示 doc 文件
【发布时间】:2019-05-28 11:45:46
【问题描述】:

我想在浏览器上显示 doc 文件。我正在使用带有 iframe 的 Google Docs API。但它向我显示谷歌文档拒绝连接的错误。我想摆脱这个错误请帮帮我..

这是我在 php 中的代码,$file 是一个变量,我在其中获取文件名,我必须将它与我的 iframe 连接起来..

   echo '<iframe src="http://docs.google.com/gview?url=http://192.168.0.56/orangehrm/admin/images/"'.$file.'&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>';

【问题讨论】:

    标签: php iframe google-docs-api


    【解决方案1】:

    基于这篇博文 - Embedding a Google Doc:

    Google 提供了一个 iFrame 来嵌入您的 Google 文档。默认情况下,出于安全原因,WordPress 会删除 iFrame 代码。在视觉和文本模式之间切换或发布时,iFrame 代码将消失。为防止出现这种情况,您需要更改提供的 iFrame 代码。

    例如:

    尝试更改:

    到:

    【讨论】:

    • 我有word文件。请告诉我需要更改 iframe 以在浏览器上显示 word 文件。
    • 您可以按照该站点中的说明将其更改为src中的Google Word文件。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-15
    • 2022-01-13
    • 2021-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多