PDA

View Full Version : Javascript passing url encoded variable to flash...works in Firefox but not IE?


Jman74
06-20-2005, 06:25 AM
Hi,

I found an old thread which showed how to get javascript to send flash a variable obtained from the URL which loads it's html page (i.e. http://www.myserver.com/index.html?myVariable=myValue )

It works a treat in Firefox but for some reason in IE it doesn't show the swf file it merely shows a white box where the swf should be and a scrollbar next to it.

The source code for the page is as follows-

<head>
<title>HOUSE WARMING INVITATION</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
body {
background-color: #666666;
margin-left: 0%;
margin-top: 50px;
margin-right: 0%;
margin-bottom: 0%;
}
.style2 {font-size: 10px;
font-family: Arial, Helvetica, sans-serif;
color: #CCCCCC;
}
.style3 {color: #FFCC00}
.style6 {font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.style7 {color: #CCCCCC}
.style8 {font-size: 12px}
a:link {
color: #FFCC00;
}
a:visited {
color: #FF0000;
}
a:hover {
color: #FFCC00;
}
a:active {
color: #FFCC00;
}
-->
</style></head>

<body>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="9" align="center" valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="760" height="77" align="middle">
<param name="movie" value="header.swf" />
<param name="quality" value="high" /><param name="SCALE" value="noborder" />
<embed src="header.swf" width="760" height="77" align="middle" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" scale="noborder"></embed>
</object></td>
</tr>
<tr>
<td colspan="9" align="center" valign="top"><script language="JavaScript">

document.write ('<OBJECT classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" '

+'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" '

+'WIDTH=760 HEIGHT=250> <PARAM NAME=movie VALUE="middle.swf'+document.location.search+'">'

+'<PARAM NAME=quality VALUE=high>'

+'<EMBED src="middle.swf' +document.location.search+'" '

+'quality=high WIDTH=760 HEIGHT=250 '

+'TYPE="application/x-shockwave-flash"></EMBED></OBJECT>')

</script>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="760" height="77" align="middle">
<param name="movie" value="tail.swf" />
<param name="quality" value="high" />
<param name="SCALE" value="noborder" />
<embed src="tail.swf" width="760" height="77" align="middle" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" scale="noborder"></embed>
</object></td>
</tr>
<tr>
<td width="48" valign="top"><div align="center"><span class="style2"></span></div>
<span class="style2"><a href="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank" class="style3">
<div align="center"></div>
</a></span></td>
<td width="4" valign="top" bgcolor="#FFCC00"><span class="style2"></span></td>
<td width="104" valign="top"><div align="center"><span class="style2"><a href="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank"><img src="get_flash_player.gif" width="88" height="31" border="0" /></a></span>
</div>
<div align="center"><span class="style2"><a href="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank" class="style3">click here </a></span></div></td>
<td width="12" height="54" valign="top"><div align="center"></div>
<span class="style2"><span class="style3">&lt;&lt;</span></span></td>
<td width="270" valign="top"><div align="center" class="style6">
<div align="left" class="style7">To view this invitation you will need Macromedia Flash Player 7. If you cannot view anything above, please follow the link provided on the left and install the Flash Player. Believe me, it's worth it and it's free!</div>
</div></td>
<td width="4" valign="top" bgcolor="#FFCC00">&nbsp;</td>
<td width="5" valign="top"><span class="style2"></span></td>
<td width="290" valign="top"><span class="style2"><span class="style8"><a href="loud_HTML.html"><span class="style3"><strong>Click here</strong></span></a> if you can't be bothered downloading the flash plug-in (which you really should download, because I said so!!</span> <span class="style8">)</span></span></td>
<td width="23" valign="top">&nbsp;</td>
</tr>
<tr>
<td height="18" colspan="9" align="center" valign="top">&nbsp;</td>
</tr>
</table>
</body>
</html>


As you can see I have inserted the relevant javascript code into the table cell which embeds the swf file called "middle.swf".

I hope my problem makes sense to someone out there....Any ideas?

Any help would be much appreciated as I am not all that good with coding...just ok with actionscript!

Cheers,
Jman

Jman74
06-20-2005, 06:54 AM
So, in an effort to get this question answered I ended up placing this same post on several different forums such as Kirupa and Flashkit. A user at Kirupa replied with the following solution which works a treat in both IE and FireFox. Here is the user's response -


*shudders at code*

Try doing it with PHP. It'd be very easy, just when you call your swf, use this instead:

Code:

middle.swf?<?php echo $_SERVER['QUERY_STRING']; ?>



And of course, save it as .php.

Hope this helps anyone with the same problem.

Cheers,
Jman