如何解决Chrome上的跨源框架加载?

时间:2017-01-11 18:29:26

标签: javascript google-chrome cross-domain hybris

我在Chrome中的网站iframe加载失败,但在Firefox上正常运行。

PFA for error for error message:

enter image description here

chrome中的错误消息:

  

未捕获DOMException:阻止具有原始“http://localhost:9001”的帧访问跨源帧。       at Object.FCKTools.FixDocumentParentWindow(http://localhost:9001/cmscockpit/zkau/web/js/ext/FCKeditor/editor/js/fckeditorcode_gecko.js:7:42291)       at Object.FCKTools.FixDocumentParentWindow(http://localhost:9001/cmscockpit/zkau/web/js/ext/FCKeditor/editor/js/fckeditorcode_gecko.js:7:42372)       at Object.FCKTools.FixDocumentParentWindow(http://localhost:9001/cmscockpit/zkau/web/js/ext/FCKeditor/editor/js/fckeditorcode_gecko.js:7:42372)       at Object.FCKTools.GetDocumentWindow(http://localhost:9001/cmscockpit/zkau/web/js/ext/FCKeditor/editor/js/fckeditorcode_gecko.js:7:42168)       at Object.FCKTools.GetElementWindow(http://localhost:9001/cmscockpit/zkau/web/js/ext/FCKeditor/editor/js/fckeditorcode_gecko.js:7:42032)       在FCKToolbarFontSizeCombo.FCKToolbarSpecialCombo.Create(http://localhost:9001/cmscockpit/zkau/web/js/ext/FCKeditor/editor/js/fckeditorcode_gecko.js:7:204406)       在FCKToolbar.Create(http://localhost:9001/cmscockpit/zkau/web/js/ext/FCKeditor/editor/js/fckeditorcode_gecko.js:7:220569)       在FCKToolbarSet.Load(http://localhost:9001/cmscockpit/zkau/web/js/ext/FCKeditor/editor/js/fckeditorcode_gecko.js:7:225568)       在LoadToolbar(http://localhost:9001/cmscockpit/zkau/web/js/ext/FCKeditor/editor/fckeditor.html?InstanceName=z_1t_ld5!ed:194:15)       at Object.StartNext(:1:644)

firefox警告:

  

主线程上的同步XMLHttpRequest因其对最终用户体验的不利影响而被弃用。如需更多帮助http://xhr.spec.whatwg.org/

不确定为什么会出现跨源错误,因为这两个地方的协议,域和端口都是相同的。

1 个答案:

答案 0 :(得分:0)

可能的原因:

1)服务器阻止在iframe中打开内容。在服务器上实现。 2)CORS。在服务器上实现。