?
Solved

Midi tags

Posted on 2005-02-28
10
Medium Priority
?
412 Views
Last Modified: 2008-01-09
I been doing many Google searches in an attempt to find a definite answer as to the correct HTML tags to use for midi that will be compatible for most of the current set of browsers.

From what I've read, <bgsound> is pretty much obsolete now and <embed src> appears to be recommended over the official <object> tag.

However, I've read conflicting information and some of it is undated, so I don't know which stuff to believe.

I realise that it's impossible to cater for all browsers, but so long as I can cater for around 90% of users, I'll be happy.
0
Comment
Question by:Tintin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 13

Expert Comment

by:nurbek
ID: 13425345
check here
bgsound is not supported by netscape

http://www.javascripter.net/faq/sound/play.htm
0
 
LVL 5

Expert Comment

by:cristy56
ID: 13425452
There can be a conflict between the tags needed for background music with Netscape and Internet Explorer browsers. To make your music accessible to more people, it is wise to include both Netscape and I.E tags.

 Netscape supports <embed> tags.
 I.E supports <bgsound> tags.

And I suggest you write some Javascript to check which browser the user is using, and then for each type of browser, u can code with different tag so that the majority user can hear the midi.

Regards,
Cristy
0
 
LVL 48

Author Comment

by:Tintin
ID: 13425473
I've read that newer versions of IE use the embed tags for midi and lost compatibility with the <bgsound> tag.

Or course, neither <bgcound> or <embed> tags are part of any of the HTML specs,  but the official <object> tag is supposed to be inflexible and not correctly supported by a lot of browsers.

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:cristy56
ID: 13425475
If u don't want any Javascript fro browser checking, u can just simply write the following code(all of them on the same homepage) :-

<embed src="filename.mid">
<noembed>
<bgsound src="filename.mid">
</noembed>

then IE will recognize bgsound and Netscape wll recognize embed and your midi file will be guaranteed to wrok under both.

Cheers,
Cristy
0
 
LVL 5

Expert Comment

by:cristy56
ID: 13425482
Well, the newest version of IE supports embed but u've no idea which version of IE most users are using, so for safety sake, it is better to write both, anyway, the browser would only run the sound file once.

Cristy
0
 
LVL 5

Expert Comment

by:cristy56
ID: 13425488
0
 
LVL 48

Author Comment

by:Tintin
ID: 13425512
cristy56.

That's the combination of tags I'm currently using, but that breaks with the latest version of IE.

See http://midistudio.com/Help/Help_HomePg.htm (which is the most useful page I've found so far).
0
 
LVL 13

Accepted Solution

by:
davidlars99 earned 1500 total points
ID: 13442666
if flash is not an option than you're stuck with <object> and <embed> tags, well with flash you'd use same combination, but you point "pluginspage" attribute to macromedia's website, which is 95% of browsers have flash support, without flash you have to do various plugin detections in javascript according to what type audio/video file you are reffering to, here is the complete decection script of most popular plugins



<html>
<body>
<code>
<pre>
// Copyright © 2000 by Apple Computer, Inc., All Rights Reserved.
//
// You may incorporate this Apple sample code into your own code
// without restriction. This Apple sample code has been provided "AS IS"
// and the responsibility for its operation is yours. You may redistribute
// this code, but you are not permitted to redistribute it as
// "Apple sample code" after having made changes.
&#60;script language="JavaScript"&#62;
&#60;!--
// initialize a variable to test for JavaScript 1.1.
// which is necessary for the window.location.replace method
var javascriptVersion1_1 = false;
// --&#62;
&#60;/script&#62;


&#60;script language="JavaScript1.1"&#62;
&#60;!--
javascriptVersion1_1 = true;
// --&#62;
&#60;/script&#62;


&#60;script language="JavaScript"&#62;
&#60;!--

// initialize global variables
var detectableWithVB = false;
var pluginFound = false;


function goURL(daURL) {
    // if the browser can do it, use replace to preserve back button
    if(javascriptVersion1_1) {
      window.location.replace(daURL);
    } else {
      window.location = daURL;
    }
    return;
}

function redirectCheck(pluginFound, redirectURL, redirectIfFound) {
    // check for redirection
    if( redirectURL && ((pluginFound && redirectIfFound) ||
      (!pluginFound && !redirectIfFound)) ) {
      // go away
      goURL(redirectURL);
      return pluginFound;
    } else {
      // stay here and return result of plugin detection
      return pluginFound;
    }      
}

function canDetectPlugins() {
    if( detectableWithVB || (navigator.plugins && navigator.plugins.length &#62; 0) ) {
      return true;
    } else {
      return false;
    }
}

function detectFlash(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('Shockwave','Flash');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
      pluginFound = detectActiveXControl('ShockwaveFlash.ShockwaveFlash.1');
    }
    // check for redirection
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectDirector(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('Shockwave','Director');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
      pluginFound = detectActiveXControl('SWCtl.SWCtl.1');
    }
    // check for redirection
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectQuickTime(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('QuickTime');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
      pluginFound = detectQuickTimeActiveXControl();
    }
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectReal(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('RealPlayer');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
      pluginFound = (detectActiveXControl('rmocx.RealPlayer G2 Control') ||
                   detectActiveXControl('RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)') ||
                   detectActiveXControl('RealVideo.RealVideo(tm) ActiveX Control (32-bit)'));
    }      
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectWindowsMedia(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('Windows Media Player');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
      pluginFound = detectActiveXControl('MediaPlayer.MediaPlayer.1');
    }
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectPlugin() {
    // allow for multiple checks in a single pass
    var daPlugins = detectPlugin.arguments;
    // consider pluginFound to be false until proven true
    var pluginFound = false;
    // if plugins array is there and not fake
    if (navigator.plugins && navigator.plugins.length &#62; 0) {
      var pluginsArrayLength = navigator.plugins.length;
      // for each plugin...
      for (pluginsArrayCounter=0; pluginsArrayCounter &#60; pluginsArrayLength; pluginsArrayCounter++ ) {
          // loop through all desired names and check each against the current plugin name
          var numFound = 0;
          for(namesCounter=0; namesCounter &#60; daPlugins.length; namesCounter++) {
            // if desired plugin name is found in either plugin name or description
            if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) &#62;= 0) ||
                (navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) &#62;= 0) ) {
                // this name was found
                numFound++;
            }  
          }
          // now that we have checked all the required names against this one plugin,
          // if the number we found matches the total number provided then we were successful
          if(numFound == daPlugins.length) {
            pluginFound = true;
            // if we've found the plugin, we can stop looking through at the rest of the plugins
            break;
          }
      }
    }
    return pluginFound;
} // detectPlugin


// Here we write out the VBScript block for MSIE Windows
if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
    document.writeln('&#60;script language="VBscript"&#62;');

    document.writeln('\'do a one-time test for a version of VBScript that can handle this code');
    document.writeln('detectableWithVB = False');
    document.writeln('If ScriptEngineMajorVersion &#62;= 2 then');
    document.writeln('  detectableWithVB = True');
    document.writeln('End If');

    document.writeln('\'this next function will detect most plugins');
    document.writeln('Function detectActiveXControl(activeXControlName)');
    document.writeln('  on error resume next');
    document.writeln('  detectActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
    document.writeln('  End If');
    document.writeln('End Function');

    document.writeln('\'and the following function handles QuickTime');
    document.writeln('Function detectQuickTimeActiveXControl()');
    document.writeln('  on error resume next');
    document.writeln('  detectQuickTimeActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('    detectQuickTimeActiveXControl = False');
    document.writeln('    hasQuickTimeChecker = false');
    document.writeln('    Set hasQuickTimeChecker = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")');
    document.writeln('    If IsObject(hasQuickTimeChecker) Then');
    document.writeln('      If hasQuickTimeChecker.IsQuickTimeAvailable(0) Then ');
    document.writeln('        detectQuickTimeActiveXControl = True');
    document.writeln('      End If');
    document.writeln('    End If');
    document.writeln('  End If');
    document.writeln('End Function');

    document.writeln('&#60;/scr' + 'ipt&#62;');
}
// --&#62;
&#60;/script&#62;

</pre>
</code>
</body>
</html>
0
 
LVL 13

Expert Comment

by:davidlars99
ID: 13701027
any updates from asker..?
0
 
LVL 48

Author Comment

by:Tintin
ID: 13881437
Haven't really got any definitiive answers here, but I'll close this anyway.
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question