Search code examples
htmliframeimdb

How to show www.imdb.com in iframe?


I want to show http://www.imdb.com in an iframe, but the below code doesn't work.

<!DOCTYPE html>
<html>
<body>

<iframe src="http://www.imdb.com/" width="400" height="400"></iframe>

</body>
</html>

Does anyone know the reason? Thank you very much.


Solution

  • The reason for this is, that imdb.com is sending an "X-Frame-Options: SAMEORIGIN" response header. This option prevents the browser from displaying iFrames that are not hosted on the same domain as the parent page.

    See: Mozilla Developer Network - The X-Frame-Options response header