2013-07-16 61 views
0

我尝试用iframe来加载一个具体的网页:加载整个网页

<!DOCTYPE html> 
<html> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
     <title></title> 
    </head> 
    <body> 
     <iframe id="frame" src="http://www.euronics.ee/" frameBorder="0" width="1000px" height="700px"></iframe> 
    </body> 
</html> 

为什么它不能加载整个页面。它只加载身体?如果我尝试,它会加载另一页。

+5

什么是*具体网页*? –

+0

'http:// www.euronics.ee' – user2301515

+0

你想让它显示除了身体? :D没有标题设置,所以不会显示。 –

回答

5

如果您检查网站的代码,你会看到:

<script type="text/javascript"> 
      //This block of javascript checks if the current page is opened in a popup IFrame 
      //and if this is true - closes popup and reloads parent window. 
      //We use Popup template for popup windows and only this template is accepted for popups. A window with any other template will be closed immidiately. 
      //This also solves the problem with redirecting to parent after user has logged in via Login popup. After loggin in user is redirected back to My Account page 
      //which in turn uses Audio template thus immidiately gets closed and parent gets reloaded. 
      if (self != top) { 
       $("body").empty(); //also clears body to avoid showing page content while the page is closing 
       parent.location.reload(); 
      } 
</script> 

这就是为什么它不会加载在你的iframe的网站,我猜。 并不是每个人都喜欢他们网站的想法,以显示在iframe中的其他网站上。我会说他们只是想要真正的游客。

0

当我尝试它的jsfiddle,我得到以下控制台错误: 封闭起源“http://www.euronics.ee”框访问与出身“http://fiddle.jshell.net”的框架。协议,域和端口必须匹配。 难道是你正在加载的网站有https请求吗?