     message: "Want to play some Noughts?", inviteCallback
 
 displayNotice = (msg) -> $(".nNotification").text(msg)
+
+setUrl = (gameId=null) ->
+  if gameId
+    window.history.pushState({}, "",
+        "?user_id=#{Meteor.userId()}&game_id=#{gameId}")
+  else
+    window.history.pushState({}, "",
+        "?user_id=#{Meteor.userId()}")
 
 PlayScreen = me.ScreenObject.extend
   handleClick_: (tile) ->

    displayError("Game not found for requestIds: " + requestIds) unless game
    Session.set("gameId", game._id)
    me.state.change(me.state.PLAY)
  $(".nNewGamePromo").css({display: "block"})

# Only runs the second time it's called, to ensure both facebook and melon.js
# are loaded

handleNewGameClick = ->
  Meteor.call "newGame", Meteor.userId(), (err, gameId) ->
    if err then throw err
    showInviteDialog (inviteResponse) ->
      return if not inviteResponse
      invitedUser = inviteResponse.to[0]
