ouyang789987 / swfobject

Automatically exported from code.google.com/p/swfobject
0 stars 0 forks source link

Flashvars parsing wrong in IE #536

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Probably this is a part of the accepted issue about flashvars, but the main 
problem was in a different behavior for browsers. Some flashvars works OK in 
any browser except IE. I would find and avoid this problem a lot faster if 
there was the same thing for all browsers.

Flashvars like this:
flashvars.input = "\x22 data \x22"
(as I understand \x codes for "&" and "=" will break it the same way)

It passes to Flash without a problem in "good" browsers, but swfObject uses a 
special way for IE with strings concatenation:
'<param name="' + j + '" value="' + parObj[j] + '" />'

I fixed it temporary by escaping \" in parObj[j].

So, either fix all escaping problems in all browser at once or add the same 
issue for other browsers :) Then a developer can find the right way (old style 
flashvars or another vars encoding) before it suddenly breaks in IE.

Original issue reported on code.google.com by flashpan...@gmail.com on 11 Feb 2011 at 1:30

GoogleCodeExporter commented 9 years ago
Good point. We will investigate. Thanks

Original comment by platelu...@gmail.com on 16 May 2011 at 5:28

GoogleCodeExporter commented 9 years ago

Original comment by platelu...@gmail.com on 18 May 2011 at 8:26

GoogleCodeExporter commented 9 years ago
I replaced createSWF's inner workings.  As previously constructed, createSWF 
generated a string for IE and native HTML <object> for non-IE. This lead to 
unequal handling of flashvars, among other things (issue 536 is focused 
specifically on the unequal flashvars handling). The non-IE handling used 
setAttribute to append flashvars to the param/object, whereas the IE version 
used string concatenation.

This proposed version of createSWF creates an <object> for ALL browsers, but 
for IE converts the <object> to a string via innerHTML before appending to the 
page using outerHTML (the outerHTML handling is retained from SWFObject 2.2).

This streamlines the code, make handling of flashvars consistent in all 
browsers, and hopefully compresses better, too.

I haven't tested it thoroughly, but so far it works in all the browsers I've 
tried, including:

OSX: Chrome 11, Firefox 4
Win7: IE9
WinXP: IE7

Original comment by platelu...@gmail.com on 24 May 2011 at 7:23

GoogleCodeExporter commented 9 years ago
FYI I further modified the approach used by createSWF; it no longer uses 
outerHTML and is streamlined to (mostly) use W3C methods (createElement, 
appendChild, etc.). Details on the <object> creation can be found here: 
http://pipwerks.com/2011/05/30/using-the-object-element-to-dynamically-embed-fla
sh-swfs-in-internet-explorer/

Original comment by platelu...@gmail.com on 30 May 2011 at 4:31