我试图显示两个不同的pdf文件在两个iframe在同一网页并排。这些pdf文件在web服务器上。在localhost上的本地运行期间,我可以在iframe中查看这些文件。但是当我在线上传我的应用程序时,这些PDF文件在iframe中是不可见的。
在一个div中有两个带有iframe的面板。
<div>
<asp:Panel runat="server" ID="pnlPDF_BKS" Style="height: 90%; width: 48%; float: left; margin-left: 3px; margin-top: 3px;">
<iframe id="ifmPDF_BKS" runat="server" style="height: 90%; width: 48%; position: absolute; margin-top: 1px; margin-left: 1%; border-style: solid; border-color: #ace1d8; min-width: 600px;"></iframe>
</asp:Panel>
<asp:Panel runat="server" ID="pnlPDF_HIN" Style="height: 90%; width: 48%; float: right; margin-right: 2%; margin-top: 3px;">
<iframe id="ifmPDF_HIN" runat="server" style="height: 90%; width: 48%; position: absolute; margin-top: 1px; margin-left: 1%; border-style: solid; border-color: #ace1d8; min-width: 600px;"></iframe>
</asp:Panel>
</div>
C#代码..
string strURL = http://www.somewebsite.com/folder/filename;
protected void btnBKS_Click(object sender, EventArgs e)
{ pnlPDF_BKS.Visible = true; ifmPDF_BKS.Src = strURL + ".pdf"; }
protected void btnADD_Click(object sender, EventArgs e)
{ pnlPDF_HIN.Visible = true; ifmPDF_HIN.Src = strURL + "_ADD.pdf"; }
我正在寻找解决方案,以查看PDF文件在iframe时,运行我的应用程序在线。
发布于 2019-05-31 02:57:03
也许这是个安全问题。如果您的在线网站使用的是SSL证书(HTTPS),那么您将无法嵌入来自没有SSL证书(HTTP)的源的iframe。在这种情况下,您应该将这些PDF文件上传到使用SSL的站点。例如GoogleDocs。
https://stackoverflow.com/questions/56368044
复制相似问题