riptide
07-11-2007, 02:32 PM
I'm having a detection script problem i need to call it's results from another function and I'm not sure how to fix the problem I know it's not right and i know why somewhat but not enoug to fix it. Ive tried moving around the function and checking everything else.
see the div is not poping up nore are the Iframes. Which do work as far as I know because I tested the code before. i'm only posting part of the code because this is where Ithink the problem is. there is a div that gets in Iframe depending on which plugin you have.
$plugin_type = {
'SVG Viewer': {
'ieAndWin': 'Adobe.SVGCtl',
'nsOrMac': 'image/svg-xml' },
'Shockwave Director': {
'ieAndWin': 'SWCtl.SWCtl.1',
'nsOrMac': 'application/x-director' },
'Flash': {
'ieAndWin': 'ShockwaveFlash.ShockwaveFlash.1',
'nsOrMac': 'application/x-shockwave-flash' },
'RealPlayer': {
'ieAndWin': 'rmocx.RealPlayer G2 Control.1',
'nsOrMac': 'audio/x-pn-realaudio-plugin' },
'QuickTime': {
'ieAndWin': 'QuickTimeCheckObject.QuickTimeCheck.1',
'nsOrMac': 'video/quicktime' },
'Windows Media Player': {
'ieAndWin': 'MediaPlayer.MediaPlayer.1',
'nsOrMac': 'application/x-mplayer2' },
'Acrobat Reader': {
'ieAndWin': 'PDF.PdfCtrl.5',
'nsOrMac': 'application/pdf' }}; function detectPlugin( $inPluginName ){
var agt = navigator.userAgent.toLowerCase();
var ie = ( agt.indexOf('msie') != -1 );
var ns = ( navigator.appName.indexOf('Netscape') != -1 );
var win = ( ( agt.indexOf('win') != -1 ) || ( agt.indexOf('32bit') != -1 ) );
var mac = ( agt.indexOf('mac') != -1 );
$pluginEnabled = false;
if( $inPluginName != 'Java' ) {
if( ie && win )
{
$pluginEnabled = detectIE( $plugin_type[$inPluginName]['ieAndWin'] ); }
if( ns || !win ) { nse = '';
for( var i = 0; i < navigator.mimeTypes.length; i++ )
{ nse += navigator.mimeTypes[i].type.toLowerCase(); }
$pluginEnabled = detectNS( $plugin_type[$inPluginName]['nsOrMac'] ); } }
else
{ $pluginEnabled = navigator.javaEnabled() ? true : false; }
return $pluginEnabled ;}
function detectNS( ClassID ){ n = '';
if( nse.indexOf( ClassID ) != -1 ) {
if( navigator.mimeTypes[ClassID].enabledPlugin != null ) { return true; }
else { return false; } }}
function detectIE( ClassID ){ result = false;
// this line needs to be broken to prevent errors in internet explorer, hence the strangeness in the middle of
</SC' + 'RIPT>
document.write( '<SCRIPT LANGUAGE=VBScript>\n on error resume next \n
result = IsObject( CreateObject("' + ClassID + '") )</SC' + 'RIPT>' );
if( result ) { return true; }
else { return false; }}
// ============================
// this portion determines what to do
// ===========================
if( detectPlugin( 'QuickTime' ) == true ){QUIFrame()}
else if( detectPlugin( 'Windows Media Player' ) == true ){WMPFrame()}
else{read()}
and this the one that is not working right.
window.onload = function() { var links = document.getElementsByTagName('a'); for (var i = 0; i < links.length; i++) { if (links[i].className == 'movieloader') {
/*find links with class="movieloader" */
links[i].onclick = function(e) {
/* attach function to each */
if (window.event) window.event.returnValue = false; else e.preventDefault();
/*stop browser from going to link href */
var mP = document.getElementById('misterioProgram'); mP.style.display = 'block'; if( detectPlugin( 'QuickTime' ) == true ){frames['timeframe'].document.getElementById('misterioProgram').getElementsByTagName('embed')[0].src = this.href;
frames['timeframe'].document.getElementById('misterioProgram').getElementsByTagName('param')[0].value = this.href; }
else if( detectPlugin( 'Windows Media Player' ) == true ){frames['playerframe'].document.getElementById('misterioProgram').getElementsByTagName('embed')[0].src = this.href;
frames['playerframe'].document.getElementById('misterioProgram').getElementsByTagName('param')[0].value = this.href; } } } }}
the area in red is what I'm worried about. both functions are in the head section.
see the div is not poping up nore are the Iframes. Which do work as far as I know because I tested the code before. i'm only posting part of the code because this is where Ithink the problem is. there is a div that gets in Iframe depending on which plugin you have.
$plugin_type = {
'SVG Viewer': {
'ieAndWin': 'Adobe.SVGCtl',
'nsOrMac': 'image/svg-xml' },
'Shockwave Director': {
'ieAndWin': 'SWCtl.SWCtl.1',
'nsOrMac': 'application/x-director' },
'Flash': {
'ieAndWin': 'ShockwaveFlash.ShockwaveFlash.1',
'nsOrMac': 'application/x-shockwave-flash' },
'RealPlayer': {
'ieAndWin': 'rmocx.RealPlayer G2 Control.1',
'nsOrMac': 'audio/x-pn-realaudio-plugin' },
'QuickTime': {
'ieAndWin': 'QuickTimeCheckObject.QuickTimeCheck.1',
'nsOrMac': 'video/quicktime' },
'Windows Media Player': {
'ieAndWin': 'MediaPlayer.MediaPlayer.1',
'nsOrMac': 'application/x-mplayer2' },
'Acrobat Reader': {
'ieAndWin': 'PDF.PdfCtrl.5',
'nsOrMac': 'application/pdf' }}; function detectPlugin( $inPluginName ){
var agt = navigator.userAgent.toLowerCase();
var ie = ( agt.indexOf('msie') != -1 );
var ns = ( navigator.appName.indexOf('Netscape') != -1 );
var win = ( ( agt.indexOf('win') != -1 ) || ( agt.indexOf('32bit') != -1 ) );
var mac = ( agt.indexOf('mac') != -1 );
$pluginEnabled = false;
if( $inPluginName != 'Java' ) {
if( ie && win )
{
$pluginEnabled = detectIE( $plugin_type[$inPluginName]['ieAndWin'] ); }
if( ns || !win ) { nse = '';
for( var i = 0; i < navigator.mimeTypes.length; i++ )
{ nse += navigator.mimeTypes[i].type.toLowerCase(); }
$pluginEnabled = detectNS( $plugin_type[$inPluginName]['nsOrMac'] ); } }
else
{ $pluginEnabled = navigator.javaEnabled() ? true : false; }
return $pluginEnabled ;}
function detectNS( ClassID ){ n = '';
if( nse.indexOf( ClassID ) != -1 ) {
if( navigator.mimeTypes[ClassID].enabledPlugin != null ) { return true; }
else { return false; } }}
function detectIE( ClassID ){ result = false;
// this line needs to be broken to prevent errors in internet explorer, hence the strangeness in the middle of
</SC' + 'RIPT>
document.write( '<SCRIPT LANGUAGE=VBScript>\n on error resume next \n
result = IsObject( CreateObject("' + ClassID + '") )</SC' + 'RIPT>' );
if( result ) { return true; }
else { return false; }}
// ============================
// this portion determines what to do
// ===========================
if( detectPlugin( 'QuickTime' ) == true ){QUIFrame()}
else if( detectPlugin( 'Windows Media Player' ) == true ){WMPFrame()}
else{read()}
and this the one that is not working right.
window.onload = function() { var links = document.getElementsByTagName('a'); for (var i = 0; i < links.length; i++) { if (links[i].className == 'movieloader') {
/*find links with class="movieloader" */
links[i].onclick = function(e) {
/* attach function to each */
if (window.event) window.event.returnValue = false; else e.preventDefault();
/*stop browser from going to link href */
var mP = document.getElementById('misterioProgram'); mP.style.display = 'block'; if( detectPlugin( 'QuickTime' ) == true ){frames['timeframe'].document.getElementById('misterioProgram').getElementsByTagName('embed')[0].src = this.href;
frames['timeframe'].document.getElementById('misterioProgram').getElementsByTagName('param')[0].value = this.href; }
else if( detectPlugin( 'Windows Media Player' ) == true ){frames['playerframe'].document.getElementById('misterioProgram').getElementsByTagName('embed')[0].src = this.href;
frames['playerframe'].document.getElementById('misterioProgram').getElementsByTagName('param')[0].value = this.href; } } } }}
the area in red is what I'm worried about. both functions are in the head section.