【问题标题】:HTTPS breaking embedded PDFHTTPS 破坏嵌入式 PDF
【发布时间】:2015-10-19 10:28:48
【问题描述】:

我刚刚在我的网站上切换到 HTTPS。我一直在通过 iframe 显示本地托管的 PDF; iframe 显示一个小的 html 文件,其中嵌入了 PDF(作为对象)。但是,PDF 不再显示。我可以导航到 PDF,它显示得很好,但在我加载 html 页面时不显示。如何使 PDF 显示?

iframe

<iframe src="/updates/update.htm" width="100%" height="800px"
marginheight="0" frameborder="0"></iframe>

update.htm

<html>
<header>
<link rel="stylesheet" href="custom-styles.css">
</style>
</header>

<body>
<object src="update.pdf"
type="application/pdf" width="100%" height="800px"><div id="show-text">
<p>It appears your web browser is not configured to display PDF files.</p>
<p><a href='update.pdf'>Click here to download the PDF file.</a></p>
</div>
</object>
</body>
</html>

自定义样式.css

#show-text {
display: block;
width: 100%;
height: 15%;
background: #D1D1D1;
}

【问题讨论】:

    标签: html pdf iframe https


    【解决方案1】:

    在黑暗中拍摄,但您确定"/updates/update.htm" 是正确的路径吗?如果您的页面是www.site.com/something/index.php 并且您使用该路径,则浏览器将查找www.site.com/something/updates/update.htm。也许你想要www.site.com/updates/update.htm。也许你需要一个像"../updates/update.htm"这样的相对路径

    更新 试试&lt;object data="update.pdf"&gt;&lt;embed&gt; 标签使用scr=&lt;object&gt; 根据 w3schools 使用 data=

    【讨论】:

    • 我已经仔细检查过,但 iframe 似乎不是问题的根源。我将 URL 从相对更改为静态,但 PDF 仍然无法显示。当我导航到 iframe 所指向的页面时,我得到一个没有 PDF 的完全空白页面。
    • 谢谢!出于某种原因,当页面通过 http 提供时
    猜你喜欢
    • 1970-01-01
    • 2015-05-10
    • 1970-01-01
    • 2018-08-04
    • 2012-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-07
    相关资源
    最近更新 更多