Javascript X-Frame-Options拒绝加载:colorbox无法在iframe中打开PDF
我在将PDF打开到colorbox iframe时遇到了问题。这是我到目前为止所采取的方法 在FileInputStream中读取文件并在OutputStream中写入 Java代码片段Javascript X-Frame-Options拒绝加载:colorbox无法在iframe中打开PDF,javascript,java,jquery,iframe,colorbox,Javascript,Java,Jquery,Iframe,Colorbox,我在将PDF打开到colorbox iframe时遇到了问题。这是我到目前为止所采取的方法 在FileInputStream中读取文件并在OutputStream中写入 Java代码片段 response.setContentType(imageContentType); OutputStream out = response.getOutputStream(); FileInputStream fis = new File
response.setContentType(imageContentType);
OutputStream out = response.getOutputStream();
FileInputStream fis = new FileInputStream(file);
byte[] buf = new byte[4096];
int len = -1;
while ((len = fis.read(buf)) != -1) {
out.write(buf, 0, len);
}
out.flush();
out.close();
JSP
<a class='cboxPDF imguid cboxElement' href='/view/B2BSpineShippingAndPaymentComponentController?showHCPOFile=true&attachmentLocation=XXXX.pdf' />
上述代码在我的本地服务器上运行良好。我可以上传并检查彩色框iframe中附加的PDF
但在主机服务器上,它不工作。Firebug正在显示此异常
Load denied by X-Frame-Options: https://b2bssit.myorders.medtronic.com/view/B2BSpineShippingAndPaymentComponentController?showHCPOFile=true&attachmentLocation=PO_S002_S10000277003_1.pdf does not permit framing.
我脑子里有两件事
)请帮助。您需要删除
meta
标记。它停止在另一个域下的iframe中打开页面的内容。它在本地工作,因为安全策略未应用于本地计算机上的页面。我们无法删除它。添加它是为了避免网络钓鱼攻击的项目策略。然后,您需要找到iframe的替代方案,因为这是唯一的方法。我尝试从firebug中删除meta标记,但仍然存在问题,您需要删除meta
标记。它停止在另一个域下的iframe中打开页面的内容。它在本地工作,因为安全策略未应用于本地计算机上的页面。我们无法删除它。添加它是为了避免网络钓鱼攻击的项目策略。然后,您需要找到iframe的替代方案,因为这是唯一的方法。我尝试从firebug中删除meta标记,但问题仍然存在
Load denied by X-Frame-Options: https://b2bssit.myorders.medtronic.com/view/B2BSpineShippingAndPaymentComponentController?showHCPOFile=true&attachmentLocation=PO_S002_S10000277003_1.pdf does not permit framing.