禁用浏览器控制台 [英] Disable Browser console

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

问题描述

我在写一个使用大量JavaScript的在线游戏,如果你开始在控制台中使用变量,或者更糟糕的是,检查DOM查看隐藏单元在哪里等。

I'm writing an online game that uses a large amount of JavaScript, and cheating would be really easy if you start fiddling with variables in the console or, worse still, checking the elements of the DOM to see where hidden units are, etc.

现在,我检测控制台何时打开并重写整个< body& / code>元素包含一条消息,说明他们必须关闭控制台并刷新页面才能继续播放。

Right now, I detect when the console is opened and rewrite the entire <body> element to contain a message explaining that they have to close the console and refresh the page to carry on playing.

有可靠的关闭方法

推荐答案

欺骗者也可以将JavaScript写入地址栏;为此,你可以在WinForms程序中托管浏览器控件,并在不打开控制台的情况下修改页面上的任何内容。你可以写自己一个很好的小作弊的应用程序,方便的按钮和友好的用户界面,并将其分发给所有的骗子朋友。你真正要做的是不信任用户的输入。在服务器上运行重要的东西,并允许客户端只发送AJAX请求。否则作弊是不可避免的。

A cheater can also write JavaScript into the address bar; for that matter, you could host a browser control within a WinForms program and modify anything on the page without ever opening the console. You could write yourself a nice little cheating app with convenient buttons and a friendly UI and distribute it to all your cheater friends. What you will really have to do is not trust input from the user. Run the important stuff on a server and allow the client only to send AJAX requests. Otherwise cheating is inevitable.

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

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