$.get("page/test.thml", function(html){
$("#iframe").contents().find("html").html(html);
},'html')
test.html包含CSS样式表。
但我得到
Resource interpreted as Stylesheet but transferred with MIME type text/html:
HTML加载,但缺少它的CSS样式。我试图将css文件内容复制粘贴到html文件本身中,但这不能解决问题。
html加载时如何使CSS显示?
最佳答案
请找到以下解决方案。
<script type="text/javascript">
$(document).ready(function () {
// Your HTML Physical file path here// Note: style should have text/css attribute.
$("#result").load("YourHTML.html", function () {
alert($("#result").html()); // This is your HTML
});
});
</script>
关于jquery - jQuery:使用html mimetype加载包含CSS样式表的html文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26008612/