[SWFObject] Short Param name problem
Nathan L.Hoover
apg1000 at gmail.com
Thu Sep 28 07:47:05 PDT 2006
Hello all,
I have been using the 1.4 version of SWFObject for about six months,
and are loving the script. It definitely solves a lot of my usability
problems.
However, after implementing a new online store, I found an issue with
the getQueryParamValue function for the embed. The problem was that the
store was adding a GET variable for "osCid", and my SWF is using a GET
variable named "d". So if the osCid variable was set, the SWFObject
embed would pick it up and assign it to my d variable. Obviously, this
produced non-expected results.
I fixed the problem by modifying the getRequestParameter function on
line 118:
// Modified the getRequestParameter function to account for short GET
variable names that
// may be part of a larger GET variable name
deconcept.util={getRequestParameter:function(_2b)
{
var q=document.location.search||document.location.hash;
if(q)
{
var _2d=q.indexOf("?"+_2b+"=");
if( _2d == -1 )
_2d=q.indexOf("&"+_2b+"=");
if(q.length > 1 && _2d > -1 )
{
var _2e=(q.indexOf("&",_2d) > -1) ? q.indexOf("&",_2d):q.length;
return q.substring(q.indexOf("=",_2d)+1,_2e);
}
}
return "";
}
This is in no way an elegance solution to the problem, but it works for
me. Thanks for all of the hard work.
Nathan
More information about the Swfobject
mailing list