2012-08-27 44 views
0

可能重複:
How to show google.com in an iframe?不能作爲SRC添加google.com的iframe

爲什麼有些網站不能被添加爲源,以我的iframe

我有這樣的代碼:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
     <script> 
     function changeIframe(newLocation){ 
      document.getElementById("myIframe").src=newLocation; 
     } 
     </script> 
    </head> 
    <body onload="changeIframe('http://www.example.com')"> 
     <div style="width:650px;float:auto;border:1px dotted #cccccc;"> 
      <iframe id="myIframe" src="http://www.ebay.co.uk/" width="100%" height=750px marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=1 scrolling=auto> 
       <p>Your browser does not support iframes.</p> 
      </iframe> 
     </div> 
    </body> 
</html> 

如果我將http://www.example.com更改爲http://www.google.com它不顯示任何內容。我用Chrome,IE,FF測試過它。

這是爲什麼?

由於

+0

不能刪除,因爲它有答案 – MaVRoSCy

回答