lidev Posted November 14, 2014 Share Posted November 14, 2014 Hi, I have seen some games lastly in which you can not consult the code from the browser console, When you go to 'Sources' to look at the code it doesn't show anything, I would like to do that in my games too but I don't know how, is there anyone who can help me about this ? Thanks Quote Link to comment Share on other sites More sharing options...
Felipe Posted November 14, 2014 Share Posted November 14, 2014 You could use closure.(function (scope) { // your code goes here. // if you want to leave something at the global scope scope.MyGlobalVariable = 'hi';}(window)); Quote Link to comment Share on other sites More sharing options...
oddskill Posted November 14, 2014 Share Posted November 14, 2014 Hi. I guess that must have been Flash games or whatever.There is no way to secure javascript code if made available for a browser. Only obfuscation is available.If someone has a diffrent knowledge on that, please let me know, best regards odd. Quote Link to comment Share on other sites More sharing options...
Sir_Everard Posted November 15, 2014 Share Posted November 15, 2014 This could have been a nodejs based site where the JavaScript is mostly server side, requiring minimal client side JavaScript. More information on the site you saw this on would help us understand what you encountered Quote Link to comment Share on other sites More sharing options...
kemz Posted November 15, 2014 Share Posted November 15, 2014 you can use Jscrambler to obfuscate(hide) your javascript source code. http://jscrambler.com/en/ Quote Link to comment Share on other sites More sharing options...
lidev Posted November 16, 2014 Author Share Posted November 16, 2014 Thanks for your suggestions guys,by 'hiding' I really mean hiding, it doesn't appear in the console/sources, I don't mean the obfuscation. Here is an example of a game in which you can see what I mean, (the js file of the game shows empty):http://www.zibbo.com/game/puzzle-games/jelly-slice Quote Link to comment Share on other sites More sharing options...
Sir_Everard Posted November 16, 2014 Share Posted November 16, 2014 It's not hidden, it's just embedded in an iFrame, see here: http://games.softgames.de/jelly-slice/?p=spilgames-zibbo&gp=1&hash=&username=&siteid=161&channelid=21&UID= All it's compressed code:http://games.softgames.de/assets/softgames-1.1.jshttp://assets.sgc.io/assets/api/voyager.js?_=3208581http://d3tlss08qwqpkt.cloudfront.net/assets/api/voyager_base-da1d578f006ea7565050dfd2c11f9702.js Quote Link to comment Share on other sites More sharing options...
Felipe Posted November 16, 2014 Share Posted November 16, 2014 The game is running on a different website and zibbo is using an iframe to run the game in their portal. What they are also doing is waiting for ad to be shown so they can load the needed sciprts asynchronously. If you look in the console you can find the softgames domain and see the scripts. Quote Link to comment Share on other sites More sharing options...
SolarJS Posted January 4, 2015 Share Posted January 4, 2015 JScrambler is a tool which can hit your performance up to 66% !!! Here are 6 reason not to use it: http://www.html5gamedevs.com/topic/5807-best-way-to-hide-javascript-code/page-2#entry65903 If you want to protect your code and keep your performance intact I recommend Google Closure Compiler in Simple Mode and after that a obfuscation toolset like Jasob or others. They keep the speed intact. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.