Coping with Recent Internet Explorer Versions


A court ruling forced Microsoft to release an update for its browser in March and April 2006 that changed the behavior of embedded media. Without the user "activating" the embedded data by clicking on it, many events are not fired and other restrictions apply. Figure 12.2 shows the information the browser provides in that case.

Figure 12.2. The embedded media (here: a Flash movie) is inactive.


However, on http://msdn.microsoft.com/workshop/author/dhtml/overview/activating_activex.asp, Microsoft explains a workaround. The idea is to use JavaScript to include the <object> element on the page. Yet due to the technical details of the ruling, the JavaScript code that creates (via the document.write() method) the <object> element must reside in an external file. So what you want to do is to first use a <script> element in the following fashion:

<script language="JavaScript"   type="text/javascript" src="/books/3/490/1/html/2/externalFile.js"> </script> 


Then, in the externalFile.js file, you output the markup that loads the embedded media file:

document.write("<object classid=\"...\" ...></object>"); 


Tip

Of course, the embedded media then works only when JavaScript is activated, so you should also have a solution in an <noscript> element. Due to the software patent that caused the court ruling, it is also possible that other browser vendors may have to implement a similar new behavior for embedded media.





JavaScript Phrasebook(c) Essential Code and Commands
JavaScript Phrasebook
ISBN: 0672328801
EAN: 2147483647
Year: 2006
Pages: 178

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net