Embed: added visibility check for embedded version, due to load/unload events not always firing.