【问题标题】:Allow portions of a website to be embedded into other websites and different domains允许将网站的某些部分嵌入到其他网站和不同的域中
【发布时间】:2014-10-03 20:56:25
【问题描述】:

我有一个包含一些图表的网站,我希望其中一些可以嵌入到其他网站中,这些网站可以位于不同的域中。

基本上,这些图是唯一的并且有一个 id,示例

...
<HTML>
...
<div id ="group1" name="G1" style="width: 900px; height: 300px; margin: 0 auto">
    <div id="graph_1" style="width: 400px; height: 300px; float: left"> </div>
    <div id="graph_2" style="width: 400px; height: 300px; float: left"></div>
</div>

<div id ="group2" name="G2" style="width: 900px; height: 300px; margin: 0 auto">
    <div id="graph_3" style="width: 400px; height: 300px; float: left"> </div>
    <div id="graph_4" style="width: 400px; height: 300px; float: left"></div>
</div>

....
</HTML>

在另一个网站上,可能是不同的域

我希望其他开发人员能够以简单的方式轻松添加一些内容,例如使用 iframe 来抓取我网页的某个部分。 示例

 ...
      <iframe src="http://www.myWebAddress/page.html/#graph_1"  -->
        scrolling="no" frameborder="no" width="400" height="300">
     </iframe>
...

但这不起作用,它包括整个页面! 我可以在源(我的页面)中进行哪些更改以使这成为可能?

问候。

【问题讨论】:

    标签: html iframe embedding


    【解决方案1】:

    只有在创建一个仅包含图表的新的唯一页面时才有可能。然后在 iframe 中使用它。

    <iframe src="http://www.myWebAddress/page.html?showonly=graph_1"
      scrolling="no" frameborder="no" width="400" height="300">
    </iframe>
    

    阅读这里,如何在js中创建一个好的小部件http://alexmarandon.com/articles/web_widget_jquery/

    或新的边缘网络组件https://hacks.mozilla.org/category/web-components/

    【讨论】:

      猜你喜欢
      • 2018-07-03
      • 1970-01-01
      • 2021-07-08
      • 2011-05-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-01
      • 2011-08-11
      相关资源
      最近更新 更多