Just to alert other gadget devs of an error in the Gadgets.* Migration
Guide document (http://code.google.com/apis/gadgets/docs/
migration.html)... The very first row of the table lists
gadgets.util.getParameters() as a replacement for _args(); problem is,
gadgets.util doesn't have a getParameters function. It's not listed at
http://code.google.com/apis/gadgets/docs/reference/#gadgets.util, and
will throw an error if you try to use it. So don't.

I'd like to think Google will see this post and correct the docs -or
better yet, add getParameters() to gadgets.util - but it appears that
they've stopped monitoring this group. <rant>What the heck, it's not
like gadgets are an important API to them or anything. </rant>

Moving on, here's a function I've used in the past to retrieve URL
parameters; it's generally worked for me, but of course YMMV. You
should be able to use it as a drop-in replacement when Google removes
the legacy functions next year. Original code came from
http://www.netlobo.com/url_query_string_javascript.html, my thanks.

function _args(name) {
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
};

String

--

You received this message because you are subscribed to the Google Groups 
"iGoogle Developer Forum" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-gadgets-api?hl=.


Reply via email to