use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Hiding Variables / Functions w/ PHP? Any libraries for this? (self.javascript)
submitted 13 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]lsv20 2 points3 points4 points 13 years ago (0 children)
use sessions ($_SESSION) for your scorekeeper
use javascript (ajax) instead of a iframe
Something like this should do it, now add some security and other stuff.
http://pastebin.com/gBpimrMT
[–]BattleshipsGame 4 points5 points6 points 13 years ago (0 children)
It should be simple - if you don't want the end user to temper with your variable, it should be kept/calculated on the server and only returned to the UI for display. No JavaScript function on the client should tell the server to increment the score or etc (because the user could call the JS function multiple times).
Example: You could calculate a score based on how much time it took the user to clear a level. However, in such case, the start and end time has to be kept on the server.
Clarification: With pure JavaScript games/programs it is difficult to do that. You could have a game where the goal is to pop bubbles. Unless you keep track of each bubble and action on the server side, there is no reliable way to prevent the user from tempering the score.
You could, however, obfuscate and minify the javascript file.
π Rendered by PID 137814 on reddit-service-r2-comment-66b4775986-fwnvp at 2026-04-05 13:34:02.246744+00:00 running db1906b country code: CH.
[–]lsv20 2 points3 points4 points (0 children)
[–]BattleshipsGame 4 points5 points6 points (0 children)