Javascript 设置:空白作为iframe的源在IE中有副作用

Javascript 设置:空白作为iframe的源在IE中有副作用,javascript,iframe,cors,Javascript,Iframe,Cors,我有一个JS代码,它创建了一个隐藏的iframe,带有src=“about:blank”(这样,如果用户不点击打开它,我就不会加载iframe的内容),当用户想要查看文件的内容时,我只需更改iframe的src 整个代码可能太多,无法粘贴,但其要点是: // executed on document ready iframeView = document.createElement('iframe') iframeView.src = "about:blank" // executed whe

我有一个JS代码,它创建了一个隐藏的iframe,带有
src=“about:blank”
(这样,如果用户不点击打开它,我就不会加载iframe的内容),当用户想要查看文件的内容时,我只需更改iframe的
src

整个代码可能太多,无法粘贴,但其要点是:

// executed on document ready
iframeView = document.createElement('iframe')
iframeView.src = "about:blank"

// executed when the user clicks the button to show the iframe
iframeView.src = "http://example.com/some-url
但是,有时(关键字为有时,即大约4/5次),在ie上,iframe内的页面会抛出错误,并且不会在该页面上执行任何JS:

原点关于:在访问控制允许原点标题中找不到

我想这和我在pageload上设置的
about:blank
有关。但是为什么呢?为什么只在IE上

编辑:尝试设置
src=”“
,消除了错误,但iframe内容页上的JS仍然没有运行