如何保护HTML5 / Canvas游戏中的代码? [英] How to protect code in HTML5/Canvas game?

查看:174
本文介绍了如何保护HTML5 / Canvas游戏中的代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

游戏制造商如何通过在流行的HTML5 / Canvas游戏的网络浏览器中右键点击网页来阻止访问者看到游戏代码?所有的游戏代码在服务器上,只是游戏代码在浏览器中的一小部分,然后在服务器和浏览器之间有一些类型的通信与Ajax,Websockets或什么?

How do game manufacturers prevent visitors from seeing the game code by right-clicking on the page in web browsers in popular HTML5/Canvas games? Are all the game code on the server and just a small part of the game code in the browser and then there is some kind of communication between server and browser with Ajax, Websockets or what?

我很好奇,想知道更多这方面吗?我正在用Canvas学习HTML5的游戏开发,我不想分享我花了这么多时间来开发的所有代码。我如何保护它?

I am curious and would like to know more about this? I'm learning game development in HTML5 with Canvas and I don't want to share all the code that I have spent so many hours to develop. How can I protect it?

推荐答案

没有办法从最终用户隐藏你的javascript。

There isn't a way to hide your javascript from the end-user.

为了执行它,它必须由用户的web浏览器加载。当它在用户计算机上时,用户可以查看它。

In order to execute it, it must be loaded by the users web browser. When it's on the users machine, the user can look at it.

您可以使用混淆器使您的代码更难阅读,但只要它是可读的浏览器,它对于确定的人也是可读的。要么与它一起生活,要么将您的关键业务秘密转移到服务器端代码,并通过AJAX或网络套接字与之沟通。

You could use an obfuscator to make your code harder to read, but as long as it is readable for the browser, it is also readable for a determined human. Either live with it, or move your critical business secrets to server-sided code, and communicate with it through AJAX or web sockets.

这篇关于如何保护HTML5 / Canvas游戏中的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆