I needed to find a way to determine if a Silverlight app had been loaded in a div of an iframe. I wasted some time trying to set a boolean flag and tracking events trying to get it set correctly. jQuery to the rescue! The consensus seems to be that this is the best way to check for the existence of a tag:
if ( $('#targetdiv').length > 0 )
or if you want to be tricky
if ( $('#targetdiv').length )
Of course, my target div was in an iframe so I used this:
if ( $('#ResultsFrame').contents().find('#silverlightControlHost').length > 0 )
No comments:
Post a Comment