简体   繁体   English

包括来自另一个网站的html文件?

[英]include html file from another website?

I tried this but it does not work form other website 我尝试过此方法,但不适用于其他网站

<script src="https://code.jquery.com/jquery-1.10.2.js"></script>    
<script> 
    $(function(){
      $("#includedContent").load("https://mywebsite.com/file.html"); 
    });
</script>

and

    <div id="includedContent"></div>

you must use iframe tag to load the html page. 您必须使用iframe代码加载html页面。 iframe is the tag which you can use for call other html pages into your web page iframe是可用于将其他html页面调用到您的网页中的代码

<iframe src="http://www.google.co.in" name="targetframe" allowTransparency="true" scrolling="no" frameborder="0" >
    </iframe>

Try this: 尝试这个:

<iframe src="https://www.my website.com/file.html"></iframe>

If this doesn't work, just comment on this answer. 如果这不起作用,请对此答案发表评论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM