禁止用户调用Web浏览器,控制台功能 [英] Disable user to call functions from console in web browser

查看:370
本文介绍了禁止用户调用Web浏览器,控制台功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我建设有HTML5和JavaScript游戏,我通过调用我的一些功能要prevent作弊(例如saveScore(100000))从网络浏览器的控制台。

So, i am building a game with html5 and javascript and I want to prevent cheating by calling some of my functions(for example saveScore(100000)) from the console in web browser.

任何想法我怎么能prevent呢?

Any ideas how can i prevent this?

推荐答案

控制台由函数执行的eval()
因此通过重写eval函数:

console are execute by the function eval() so override the eval function by:

window.eval=function(){};

现在控制台禁用结果
但是,这也不是好主意,因为它不能prevent书签的执行,以便使用@安东尼的主意。

Now console is disabled
But this is also not good idea because it cannot prevent the execution of bookmarklet so use @Anthony's idea.

这篇关于禁止用户调用Web浏览器,控制台功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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