Click to return to the Windows Media Technologies home page    
Web Workshop  |  Streaming & Interactive Media  |  Windows Media Technologies

Enabling Netscape Navigator to Receive Script Events


September 21, 1998

If you've followed the instructions in Step 1, you should now have a Web page that can play embedded files in the Windows Media Player in both Internet Explorer and Netscape Navigator. Your ActiveX control can receive script events and play them back in Internet Explorer 3.x or later. You will need to add more code to get these events to work in Netscape Navigator.

Add the following JavaScript function between the </HEAD> and <BODY> tags. This code first checks to see whether the current browser is Netscape Navigator. If yes, a small Java applet (downloaded in Step 1) will monitor the Netscape Navigator plug-in for script events.

function RegisterEventObservers() { 
   if(navigator.appName == "Netscape") {
      var plugin = document.MediaPlayer;
      document.appObs.setByProxyDSScriptCommandObserver(plugin, true); 
      }
   }
You will need to run this code when the Web page loads. To do this, add an OnLoad event for the RegisterEventObservers function inside the <BODY> tag, as follows:

<BODY onLoad="RegisterEventObservers()" BGCOLOR="#000000" LINK="#000066">

HomeBack to the Advanced Scripting for Cross-Browser Functionality page



Back to topBack to top

Did you find this material useful? Gripes? Compliments? Suggestions for other articles? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.