javascript - how to hide an iframe if content is empty -


i using iframe in displaying content external url. want hide iframe if there no content display (i.e empty). please let me know how this.

if want check content external url inside iframe empty, , iframe not cross-domain check existence of body tag inside of iframe. if exists, loaded. if can use jquery, check it's length property. cross-browser compatible. if it's zero, doesn't exist.

code:

if($("#iframeid").contents().find("body").length) {     // html page loaded in iframe } 

if iframe cross-domain, blocked same-origin policy. otherwise work.

source: how check if iframe empty/null/undefined?


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -