Jazz-Soft.net

We make it sound!

Home » Documentation » Jazz-Plugin » Enabling Jazz-Plugin

Enabling Jazz-Plugin

Jazz-Plugin object

To enable Jazz-Plugin on your page, place the following code somewhere in the document body:

<object id="Jazz1" classid="CLSID:1ACE1618-1C7D-4561-AEE1-34842AA85E90" class="hidden">
  <object id="Jazz2" type="audio/x-jazz" class="hidden">
<p style="visibility:visible;">This page requires <a href=http://jazz-soft.net>Jazz-Plugin</a> ...</p>
  </object>
</object>

The outer object is for Microsoft Internet Explorer, and the inner one - for normal browsers..

NOTE: Microsoft IE 10 in Windows 8 requires the following HTTP header in order to allow ActiveX objects on page:

X-UA-Compatible: requiresActiveX=true

It can be set either via server configuration or by adding the <META> tag in HTML head:

<meta http-equiv="X-UA-Compatible" content="requiresActiveX=true"/>

Thank you, Microsoft, for being so wonderfully compatible with the rest of the world!

If the plugin is not installed, it would be wise to show a plugin download link. If you don't want any default html displayed,
use at least &nbsp; between <object> and </object>, or some browsers will show annoying pop-up messages like this:

The object does not look too fancy on screen, so we can safely make it invisible with the style like this:

<style type="text/css">
.hidden {
 visibility: hidden;
 width: 0px;
 height: 0px;
 margin: 0px;
 padding: 0px;
 border-style: none;
 border-width: 0px;
 max-width: 0px;
 max-height: 0px;
}

Now, check which of two objects is the actual Jam-Plugin,

<script><!--
var Jazz = document.getElementById("Jazz1"); if(!Jazz || !Jazz.isJazz) Jazz = document.getElementById("Jazz2");
--></script>

- and we are ready to play:

<script><!--
Jazz.MidiOut(0x90,60,120);
--></script>

You may also want to create plugin instances dynamically:

<div id=here></div>

<script><!--
function create_plugin(where){
 var obj=document.createElement('object');
 obj.classid="CLSID:1ACE1618-1C7D-4561-AEE1-34842AA85E90";
 if(!obj.isJazz) obj.type="audio/x-jazz";
 obj.style.visibility='hidden';
 obj.style.width='0px'; obj.style.height='0px';
 where.appendChild(obj);
 if(obj.isJazz) return obj;
 where.removeChild(obj);
 throw "Cannot create Jazz-Plugin";
}
var Jazz=create_plugin(document.getElementById('here'));
--></script>

Everything else - just your creativity.

Have fun!

See also