<p>I am creating a jQuery plugin.</p>

<p>How do I get the real image width and height with Javascript in Safari?</p>

<p>The following works with Firefox 3, IE7 and Opera 9:</p>

<pre><code>var pic = $("img")

// need to remove these in of case img-element has set width and height
pic.removeAttr("width"); 
pic.removeAttr("height");

var pic_real_width = pic.width();
var pic_real_height = pic.height();
</code></pre>

<p>But in Webkit browsers like Safari and Google Chrome values are 0.</p>

this works for me (safari 3.2), by firing from within the
```
window.onload
```
event:
```
```
$(window).load(function() {
  var pic = $('img');

  pic.removeAttr("width"); 
  pic.removeAttr("height");

  alert( pic.width() );
  alert( pic.height() );
});
```
```