javascript - How to get the height and width of an iframe -


how height , width of iframe, executing script outside iframe?

i want find dimensions.

javascript solutions welcomed.

using jquery:

$('iframe').height(); $('iframe').width(); 

edit elaborating on quick , dirty answer above. .height() , .width() give element's height , width without padding, border or margin.

if want include padding , border need use .innerheight() , .innerwidth(). example below:

$('iframe').innerheight(); $('iframe').innerwidth(); 

if want include padding , border , margin need use .outerheight() , .outerwidth(). example below:

$('iframe').outerheight(); $('iframe').outerwidth(); 

links methods above:
https://api.jquery.com/height/
https://api.jquery.com/innerheight/
https://api.jquery.com/outerheight/
https://api.jquery.com/width/
https://api.jquery.com/innerwidth/
https://api.jquery.com/outerwidth/


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -