【发布时间】:2016-11-04 23:37:34
【问题描述】:
我需要打印一个 PDF...但是我收到一个错误
有解决方法吗?我只需要一键打印一个PDF文件
错误:
Uncaught SecurityError: Blocked a frame with origin "https://secure.domain.com" from accessing a frame with origin "https://cdn.domain.com". Protocols, domains, and ports must match.
代码:
var iframe = $('<iframe src="'+url+'" style="display:none"></iframe>').appendTo($('#main')).load(function(){
iframe.get(0).contentWindow.print();
});
【问题讨论】:
-
好吧,我相信错误信息非常具有描述性:协议、域和端口必须匹配。
secure.domain.com与cdn.domain.com不同。 -
必须有解决方法
标签: javascript