如何在网页加载时将网页内容加载到div中? [英] How can I load webpage content into a div on page load?

查看:91
本文介绍了如何在网页加载时将网页内容加载到div中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不使用iframe,是否可以加载

Without using iframes, is it possible to load the contents of

<div id="siteloader"></div>

具有外部网站,例如somesitehere.com

With an external site e.g. somesitehere.com

页面何时加载? -我知道如何从文件加载内容,但是不确定如何加载整个网站吗?

When the page loads? - I know how to load contents from a file, but wasn't sure how to load a whole site?

非常感谢,

推荐答案

这可以在没有iframe的情况下专门进行.由于标题中提到了jQuery,因此使用了它.

This is possible to do without an iframe specifically. jQuery is utilised since it's mentioned in the title.

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Load remote content into object element</title>
  </head>
  <body>
    <div id="siteloader"></div>​
    <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
    <script>
      $("#siteloader").html('<object data="http://tired.com/">');
    </script>
  </body>
</html>

这篇关于如何在网页加载时将网页内容加载到div中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆