...

View Full Version : Javascript page looks different in Mac vs PC!



aryastark
08-16-2004, 05:32 AM
Hi all,
I've recently included a javascript code in one of my webpage to detect for Flash swf files. The code works fine on a PC but when i checked it on a Mac, the page actually has a duplicate of the swf file right at the top of the page.

The code is as follows:

================
<!-- FLASH DETECTION SCRIPT-->
<SCRIPT LANGUAGE=JavaScript1.1>
<!--
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ?

navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
var words = navigator.plugins["Shockwave Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i)
{
if (isNaN(parseInt(words[i])))
continue;
var MM_PluginVersion = words[i];
}
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
&& (navigator.appVersion.indexOf("Win") != -1)) {
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
document.write('on error resume next \n');
document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
document.write('</SCR' + 'IPT\> \n');
}
if ( MM_FlashCanPlay ) {
document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
document.write(' ID="script" WIDTH="295" HEIGHT="243" ALIGN="">');
document.write(' <param name="movie" value="flash/flash_studio.swf"> <PARAM NAME=quality VALUE=high> ');
document.write(' <embed src="flash/flash_studio.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="295" height="243"> ');
document.write(' swLiveConnect=FALSE WIDTH="295" HEIGHT="243" NAME="script" ALIGN=""');
document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
document.write(' </EMBED>');
document.write(' </OBJECT>');
} else{
document.write('<IMG SRC="images/flash_rep_studio.gif" WIDTH="295" HEIGHT="243" usemap="#script" BORDER=0>');
}
//-->
</SCRIPT><NOSCRIPT><IMG SRC="images/flash_rep_studio.gif" WIDTH="295" HEIGHT="243" usemap="#script"

BORDER=0></NOSCRIPT>
<!-- END FLASH DETECTION SCRIPT -->
================

Any idea why this is happening on a Mac?

arya

Willy Duitt
08-16-2004, 06:40 AM
Hi all,
I've recently included a javascript code in one of my webpage to detect for Flash swf files. The code works fine on a PC but when i checked it on a Mac, the page actually has a duplicate of the swf file right at the top of the page.

The code is as follows:

================
<!-- FLASH DETECTION SCRIPT-->
<SCRIPT LANGUAGE=JavaScript1.1>
<!--
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ?

navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
var words = navigator.plugins["Shockwave Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i)
{
if (isNaN(parseInt(words[i])))
continue;
var MM_PluginVersion = words[i];
}
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
&& (navigator.appVersion.indexOf("Win") != -1)) {
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
document.write('on error resume next \n');
document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
document.write('</SCR' + 'IPT\> \n');
}
if ( MM_FlashCanPlay ) {
document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
document.write(' ID="script" WIDTH="295" HEIGHT="243" ALIGN="">');
document.write(' <param name="movie" value="flash/flash_studio.swf"> <PARAM NAME=quality VALUE=high> ');
document.write(' <embed src="flash/flash_studio.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="295" height="243"> ');
document.write(' swLiveConnect=FALSE WIDTH="295" HEIGHT="243" NAME="script" ALIGN=""');
document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
document.write(' </EMBED>');
document.write(' </OBJECT>');
} else{
document.write('<IMG SRC="images/flash_rep_studio.gif" WIDTH="295" HEIGHT="243" usemap="#script" BORDER=0>');
}
//-->
</SCRIPT><NOSCRIPT><IMG SRC="images/flash_rep_studio.gif" WIDTH="295" HEIGHT="243" usemap="#script"

BORDER=0></NOSCRIPT>
<!-- END FLASH DETECTION SCRIPT -->
================

Any idea why this is happening on a Mac?

arya


Have you tried looking here (http://www.webdeveloper.com/forum/showthread.php?s=&threadid=41880)....

sad69
08-16-2004, 07:18 PM
Is someone implying an infinite loop? :D

Sadiq.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum