我尝试过这个,但它在其他网站上不起作用
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script>
$(function(){
$("#includedContent").load("https://mywebsite.com/file.html");
});
</script>
和
<div id="includedContent"></div>
最佳答案
您必须使用iframe
标签来加载html页面。
iframe
是您可以用来将其他 html 页面调用到您的网页中的标签
<iframe src="http://www.google.co.in" name="targetframe" allowTransparency="true" scrolling="no" frameborder="0" >
</iframe>
关于javascript - 包含来自其他网站的 html 文件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51089406/