将PDF打开到colorbox iframe时遇到问题。这是我到目前为止所做的方法..
在FileInputStream中读取文件并将其写入OutputStream。
Java Code Snippet ..
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' />
JS ..
$(".cboxPDF").colorbox({
scrolling: false,
iframe:true,
innerWidth:725,
innerHeight:545,
overlayClose: false,
onOpen: function(){
$("#colorbox").css("opacity", 0);
$(".page-loaderOverlay").show();
},
onComplete: function(){
$(".overlay").show();
$(".page-loaderOverlay").hide();
$("#colorbox").css("opacity", 1);
}
});
以上代码在我的本地服务器上正常运行。我可以在colorbox 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 http-equiv="X-Frame-Options" content="SAMEORIGIN">
)我无法理解为什么它在本地工作但不在主机服务器上工作。
请帮忙。