【问题标题】:viewer js only shows index.html查看器 js 仅显示 index.html
【发布时间】:2015-06-03 17:36:23
【问题描述】:

我正在尝试在我的网站上的 iframe 中显示 .pdf,但按照 viewerjs.org 上的说明会生成一个 iframe,该 iframe 仅在 ViewerJS 中显示 index.html 文件。我的 apache 文档根目录位于
/var/www/lifecycle/htdocs
ViewerJS 目录位于
/var/www/lifecycle/htdocs/js/ViewerJS
我要显示的 pdf 位于 apache 文档根目录中。我有用于测试浏览器的最新 php、apache2 和 iced-tea 插件。相关的 iframe 元素是:
<iframe allowfullscreen webkitallowfullscreen src="/js/ViewerJS/#../Homestake_Lease_Brennan_Agreement.pdf" id="viewerjs_preview"></iframe>

提前致谢!

【问题讨论】:

    标签: javascript html apache iframe


    【解决方案1】:

    抱歉,有点晚了,但你必须写下这段代码。在我的情况下,我使用 localhost 所以它会是这样的: <iframe allowfullscreen webkitallowfullscreen src="http://localhost/js/ViewerJS/#../Homestake_Lease_Brennan_Agreement.pdf" id="viewerjs_preview"></iframe>

    您必须将此代码放入您的 html 中。

    【讨论】:

      【解决方案2】:

      原来我的网络服务器没有配置为自动将 index.html 用于“#”,并且在找到 ViwerJS 目录后在源代码中使用的路径是相对于 ViewerJS 的内容,而不是包含的目录ViewerJS。
      iframe 的正确格式是:
      <iframe allowfullscreen webkitallowfullscreen src="/js/ViewerJS/#index.html../../Homestake_Lease_Brennan_Agreement.pdf" id="viewerjs_preview"></iframe>

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-11-07
        • 1970-01-01
        • 1970-01-01
        • 2017-05-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-01-20
        相关资源
        最近更新 更多