我已完成以下操作以将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编码,并且不会显示在新窗口中.
解决方法:
从MSDN库中的data Protocol文章:
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.