从页面隐藏脚本'源代码 [英] Hiding a Script from the pages' source code

查看:38
本文介绍了从页面隐藏脚本'源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的源代码中隐藏一段 Javascript.我想到的方法是使用带有脚本文件的 PHP 包含,但这似乎不起作用.

I would like to hide a piece of Javascript from my source code. Ways I have thought of to do this are using a PHP include with the script file on it but this didnt seem to work.

有人对我有什么建议吗?如果您需要我的脚本副本,请直接询问.

Does anyone have any suggestions for me? If you need a copy of my script just ask.

提前致谢,卡勒姆

推荐答案

你不能阻止用户看到你的 JavaScript 源代码......无论你如何交付它.任何尝试查看您的来源的用户都可能具备这样做的专业知识.您正在向客户端提供一个脚本来运行,因此无论它是在页面中、包含在页面中、AJAX 获取还是打包,都没有关系,它仍然是可见的,并且在某种程度上很容易复制.

You can't prevent a user from seeing your JavaScript source...no matter how you deliver it. Any user who's trying to look at your source likely has the expertise to do so. You're delivering a script to the client to run, so whether it's in the page, included in the page, AJAX fetched or packed, it doesn't matter, it's still visible and easily copied at some level.

这篇关于从页面隐藏脚本'源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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