Reputation: 129
I use code like this to embed webpage within a webpage:
<object data="http://www.cnn.com" type="text/html">
<embed src="http://www.cnn.com" type="text/html" />
</object>
For some sites this works, but for some it doesn't - it doesn't show anything. Why? It there something that can be fixed with the code or is it better to embed sites in some different way?
Here is example of site that works and site that doesn't work: http://jsfiddle.net/fqpfj1th/1/
Upvotes: 4
Views: 76
Reputation: 344763
Probably due to the X-Frame-Options
header being present:
Accept-Ranges:bytes Cache-Control:max-age=0, no-cache, no-store Connection:keep-alive Content-Encoding:gzip Content-Language:en Content-Length:9459 Content-Type:text/html; charset=utf-8 Date:Sun, 10 May 2015 13:51:36 GMT ETag:"1431265860-0" Expires:Sun, 10 May 2015 13:51:36 GMT Last-Modified:Sun, 10 May 2015 13:51:00 GMT Link:; rel="canonical",; rel="shortlink" Pragma:no-cache Server:Apache Vary:Accept-Encoding X-Drupal-Cache:MISS X-Frame-Options:SAMEORIGIN X-Generator:Drupal 7 (http://drupal.org) X-Powered-By:PHP/5.3.3 X-Server:web05a.sjc05.teslamotors.com X-Varnish:1302280716 X-Varnish-Server:varnish02a.sjc05.teslamotors.com
This is a non-standard header that is superseded by the CSP Level 2 spec, but has better support across browsers.
https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options
Upvotes: 2