Html 单击标记时如何在iframe中打开pdf
我试图在iframe中加载pdf时,单击表下同一页上的Open pdf。 当我使用target=blank时,此pdf将在新选项卡上打开,但不会在iframe中打开Html 单击标记时如何在iframe中打开pdf,html,spring-boot,jstl,Html,Spring Boot,Jstl,我试图在iframe中加载pdf时,单击表下同一页上的Open pdf。 当我使用target=blank时,此pdf将在新选项卡上打开,但不会在iframe中打开 <c:forEach items="${files}" var="file"> <tr> <td>${file.name}</td> <td>${file.createdOn}</td> <td><a href="http://localhos
<c:forEach items="${files}" var="file">
<tr>
<td>${file.name}</td>
<td>${file.createdOn}</td>
<td><a href="http://localhost:8080/dms/getFile?filePath=${file.realPath}" target="search_iframe">Open PDF</a></td>
</tr>
</c:forEach>
</table>
<iframe src="" width="100%" height="100%" name="search_iframe"></iframe>
</body>
${file.name}
${file.createdOn}
我正在使用bootstrap 4作为我的主题之一,我点击按钮打开模式,在该模式下,我放置iframe以打开我的PFD。你也可以试一下。如果您不使用引导,您可以创建自己的自定义模式
<a href="javascript:void(0);" data-toggle="modal" data-target="#staffInformationForCBSE">
<div class="modal fade" id="staffInformationForCBSE">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title text_orange">Staff Information for CBSE</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<iframe class="pdf_documents" src="documents/StaffInfoForCBSE.pdf"></iframe>
</div>
</div>
</div>
</div>
CBSE的员工信息
&时代;
在“新建”选项卡中打开的pdf实际上是由浏览器打开的,因此它不能在iframe中显示,如果您真的想在iframe中打开pdf,可以使用一些js库来呈现pdf文件,如pdf.js[请阅读这些已经讨论过的链接: