I have made a game using HTML5 Canvas Element, Javascript for facebook. There are two problems I am facing.
PROBLEM 1
1.My game is inside an iframe in the facebook app so when I use the onkeydown even of Javascript and press down arrow key, the game works normally but the scrollbars go up and down. I have uploaded the game and set it up already. It can be found at: snake.
PROBLEM 2
2.I totally can't understand how to use the graph API, since I have no knowledge of cURL, for posting the score earned on the wall without asking the player since if I ask them just like "facebook wants me to" th开发者_StackOverflowe player can change it.
1. You must use some method to stop event from bubbling or captured by parent:
for IE
window.event.cancelBubble = true
For Firefox, Safari, Chrome, Opera
e.stopPropagation()
e.preventDefault()
For more info read this document: http://www.quirksmode.org/js/events_order.html
2. You need to use ajax to submit score from user browser, not from server, because of you will have not user's authentication's token/cookie which use to identify what's user submitting the score. If you use ajax then browser will automatically push cookie together with request then you don't care about that.
精彩评论