I got an iframe in my page. Like this :
<iframe width="600px">
<html>
<head>
</head>
<body>
<p>Some text</p>
<img src="/foo/bar/test.png" />
</body>
</html>
</iframe>
I want to be able to detect if the iframe contents is larger than 600px. I tried this one :
var iframe = $('iframe');
if (iframe.width() < iframe.contents().width()) {
console.log('contents larger than the iframe');
}
It works on Firefox and Internet Explorer. But not on Chrome. On Chrome, iframe.contents().width()
is 600.
I tried iframe.contents().find('body').width()
but the result is also 600.
How can i detect the iframe contents real width in Chrome ?