0
我正在使用我想使用自己的css样式的外部iframe。 iframe是由一个javascript巫婆加载并创建的,本身由另一个javascript加载。由于这是一家公司提供的服务,我无法控制其javascript产生的内容或iframe内容。无法在Internet Explorer中将样式表添加到iframe中
我做了什么至今使用jQuery是一个使用窗口的onload这样我所有的自定义CSS文件加载到iframe中:
window.onload = function() {
$('iframe').addClass('styledIframe');
var $c = $('.styledIframe').contents();
//clone all styles from this document into the iframe
$c.find('head').append($('style, link[rel=stylesheet]').clone());
}
iframe的改变ID,每次它加载,这样,为什么我添加了“styledIframe”类。对我的问题:这适用于所有浏览器exep Internet Explorer,完美,我试过了IE9和更低,它不工作在任何他们。
我可以做什么使这项工作在IE浏览器?
请参阅http://stackoverflow.com/questions/524696/how-to-create-a-style-tag-with-javascript –