IndiePaivaGame / swfobject

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

ExpressInstall redirect not redirecting with all GET variable after updating Flash #172

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Make a page that has multiple GET variables to get to the right content
2. Attach any SWF file that requires a newer version of Flash.
3. Let ExpressInstall.swf upgrade your installation of Flash.

What is the expected output? What do you see instead?
After the update is finished, the ExpressInstall should redirect the
browser back to the original page. Instead, it redirects back to a page
containing only the first GET variable (this causes a server error redirect
on my system)

What version of the product are you using? On what operating system?
SWFObject V2.1
Windows Vista Ultimate 64-bit

Please provide any additional information below.
The code added to the page for the ExpressInstall encodes the Ampersands
("&") in the original link to &, and adds it directly to the flashvars
parameter for ExpressInstall. Due to the ampersand, it is recognized as a
new flashvar variable and not a part of the original link.  It needs to be
encoded to "%26" instead. I have corrected the minified code on my end to
accomplish this by changing the following:

   r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q

   changed to

r="MMredirectURL="+j.location.toString().replace(/&/g,"%26")+"&MMplayerType="+z+
"&MMdoctitle="+q

Running the "replace" method on j.location directly will not work, as it is
undefined in Firefox 3. It is technically a URL type and not a String, so
the replace method does not exist. It works fine if adding the "toString"
method before it.

Original issue reported on code.google.com by christop...@gmail.com on 11 Sep 2008 at 10:33

GoogleCodeExporter commented 9 years ago
Thanks for the clear issue report, we will add this issue to our enhancement 
request
list for SWFObject version 2.2

Original comment by bobbyvandersluis on 12 Sep 2008 at 9:03

GoogleCodeExporter commented 9 years ago
This worked for me:

var flashvars = {
    flashvar_here: escape(‘http://your_url.com&foo=bar’)
}

Original comment by jeremyri...@gmail.com on 18 Sep 2008 at 7:30

GoogleCodeExporter commented 9 years ago
To jeremyricketts:

Yes, the escape function should work just fine for the redirect (I was unable 
to test
it since my flash was already updated and expressInstall doesn't run unless 
there is
a newer version), but in this case the redirect passed into expressInstall is 
not in
the flashvar list that you give it. If you wanted to give a link to your own 
flash
SWF then that would be the proper way to use it.

The problem only happens when the swfobject script adds the expressInstall SWF
instead, due to a version of Flash to old to work with your original SWF. When
swfobject creates the expressInstall SWF instead, it adds a "redirect to self on
complete" flashvar called MMredirectURL and gives it the variable 
document.location
as the value. That value is what needs to either be
escape(document.location.toString()) or just encode the ampersands with
document.location.toString().replace(/&/g,"%26").

Original comment by christop...@gmail.com on 22 Sep 2008 at 5:46

GoogleCodeExporter commented 9 years ago
Another option for the encoding would be 
"encodeURIComponent(document.location)",
which of course the variable "j" is a reference to document.  I also just 
realized
this issue has already been reported in July, Issue #134. Go check that out too 
to
see other solutions until 2.2 is out.

Original comment by christop...@gmail.com on 22 Sep 2008 at 5:55

GoogleCodeExporter commented 9 years ago
For what it's worth, this bug report identified a similar problem with the 
CheckPlayer (http://checkplayer.flensed.com) code, and the fix (v0.7-alpha4) 
was as 
simple as the original post, which essentially was:

MMredirectURL:win.location.toString
-became-
MMredirectURL:win.location.toString().replace(/&/g,"%26")

Original comment by get...@gmail.com on 4 Oct 2008 at 2:29

GoogleCodeExporter commented 9 years ago
Copied over from issue report #134:

What steps will reproduce the problem?
1. hit url with flash player version < required version
2. close browser (firefox 2.0)
3. accept express install prompt
4. browser reloads, adobe site redirects to original page, but only first
parameter of many is included

(for example, original page - http://a.com?a=1&b=2&c=3, after redirect -
http://a.com?a=1)

What version of the product are you using? On what operating system?
2.0, Firefox 2.0

--

replacing this code
r="MMredirectURL="+j.location
with 
r="MMredirectURL="+encodeURIComponent(j.location)

fixed the issue

Original comment by bobbyvandersluis on 3 Nov 2008 at 12:23

GoogleCodeExporter commented 9 years ago
any thoughts on if using encodeURIComponent() is sufficiently cross-browser 
enough 
for 2.2 to use it instead of falling back to the String.replace() method?

Original comment by get...@gmail.com on 3 Nov 2008 at 1:05

GoogleCodeExporter commented 9 years ago
Fix included in 2.2 alpha 9.

Original comment by bobbyvandersluis on 5 Jan 2009 at 4:42

GoogleCodeExporter commented 9 years ago
Included in the SWFObject 2.2 beta1 release

Original comment by bobbyvandersluis on 16 Apr 2009 at 3:05