The Obama administration’s just finished “Open for Questions“, where the President answered questions suggested and voted by the general public over the web. This is pretty cool – political openness, interaction, and democracy via the web. It’s also interesting to me because the site uses Google Moderator, a product we use at work all the time.
What’s not quite so cool is that Moderator apparently doesn’t play well with the rest of the web. I’m not sure why it was designed this way (and if I did know, I probably couldn’t tell you anyway). The design is the exact opposite of unobtrusive javascript. That’s fine for highly interactive web apps but it would be nice to see the mostly text content in Moderator made searchable just like any other collection of web pages.
Another thing that bugs me (and others) is the lack of a simple way to link to one particular question. If I post a question to Obama about the plight of the unladen African swallows, I’ll probably want to share it with my friends to drum up votes. After the voting is over, it still might be cool to link directly to my question in my blog – depending on how the owner has set up the Moderator Topic, there may be a whole thread of responses.
And actually, if the Topic is set up to allow responses to each question, finding a useful link is pretty easy – all you have to do is right-click and copy the location of the “Post a response” link.
For example, on my test topic, the link looks like this:
http://moderator.appspot.com/#15/e=372fa&t=372fb&q=30f44&v=4
Anyone who follows you link can see the question and vote on that page whether or not they want to comment.
On the other hand, if the owner of the topic hasn’t set it up to allow responses, things get a bit more complicated:
Using a Firefox plugin like Tamper Data or Live HTTP Headers, open a window to watch the HTTP traffic in your browser. Now vote on the question you want to generate a url for.
You should see an HTTP post like this:
URL=http://moderator.appspot.com/rpc?setQuestionVote
Within the POSTDATA, you should see something like this:
POSTDATA={"href":"http://moderator.appspot.com/#15/e=372fa&t=372fb", "args":{"action":"setQuestionVote", "args":{"question_key":"30f44", "vote":"MINUS", ...
That href is a good start. To make the url work we need 5 url parameters – we already have three, so we just need the value for q and v. The “question_key” value will be used for q and the number 4 seems to work for v, so ultimately you end up with a url like this:
http://moderator.appspot.com/#15/e=372fa&t=372fb&q=30f44&v=4
Note that nothing above requires any secret inside knowledge or anything – all I’m doing is paying attention to the data being sent back and forth to my browser. If you’re a web developer and you’ve ever wondered how all the fancy AJAX on a particular site works, I highly recommend getting more familiar with HTTP like this. It’s a bit more complicated than just viewing the source HTML and downloading some external javascripts, but it’s the same idea.