Make the div visible, but position it outside the page with position: absolute;.
If your "other code" doesn't let you do this either, create a new image node with the same URL, position it outside the page, wait until it's loaded, read its height and destroy.