<script type="text/javascript">
function showImg(url) {
var frameid = 'frameimg' Math.random();
window.img = '<img id="img" style="width: 100%;height: auto" src=\'' url '?' Math.random() '\' /><script>window.onload = function() { parent.document.getElementById(\'' frameid '\').height = document.getElementById(\'img\').height \'px\'; }<' '/script>';
document.write('<iframe id="' frameid '" src="javascript:parent.img;" frameBorder="0" scrolling="no" width="100%"></iframe>');
}
</script>
<div>
<script type="text/javascript">showImg("图片url");</script>
</div>
本人已经测试通过了