我已完成以下操作以将我的 xml 显示到新的浏览器窗口中:
window.open('data:text/xml,' + encodeURIComponent( '<?xml version="1.0" encoding="utf-8"?><Document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02"><parent>test</parent></Document>' ));
在所有浏览器中都能很好地工作...但显然是 IE。我正在使用 IE10。我应该怎么做才能让它发挥作用?现在,xml 是 URL 编码的,不会显示在新窗口中。
最佳答案
来自data Protocol MSDN 库中的文章:
For security reasons, data URIs are restricted to downloaded resources. Data URIs cannot be used for navigation, for scripting, or to populate frame or iframe elements.
关于javascript:使用数据uri显示xml流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17595729/