iframe跨端口报错 简单解决方法
报错信息
Uncaught DOMException: Blocked a frame with origin “https://www.XXX.com” from accessing a cross-origin frame. at https://www.XXX.com/XXX/XXX.do?1=1
代码
<script type="text/javascript">
document.domain = 'XXX.com';
//清除file控件的值
parent.document.getElementById('ss').value = '';
</<script>
解决方法
在报错的代码前增加 document.domain = ‘XXX.com’;