Dynamically Adding New Flash Objects to Your Page

Back in the days of a now dormant Internet startup, we ran into an issue of how to dynamically add new objects (Flash or otherwise) to your page. If you simply do document.write() with some <object> tags in it, it does not work. The browser refuses to interpret new object tags.

However, there is a twist. It turns out you can add new iframes in JavaScript. You, a seasoned web developer, probably new it for years, but I discovered it by accident while trying to fight weird behavior of one of the popular social networks. Anyhow, you can add iframes dynamically, and these iframes may contain flash movies.

Here’s is an example that I wrote using a little PHP. Enjoy! If this sounds very trivial, I am sorry, us mere mortals sometimes have their ‘aha’ moments they do enjoy 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *