简体   繁体   English

如何获取脚本文件的代码?

[英]How can i get the code of script file?

We are developing a web based application. 我们正在开发基于Web的应用程序。 In this we want to hide a script files from browser's page source. 在此,我们想从浏览器的页面源中隐藏脚本文件。 After some research we are planned to push the script files dynamically on browser page load, and also after page loaded we empty the source of the script files. 经过一些研究,我们计划在浏览器页面加载时动态推送脚本文件,并且在页面加载之后,我们清空脚本文件的源。 By using this method we are hide the script files from browser's page source.Is there any other method to get the script files. 通过使用这种方法,我们从浏览器的页面源中隐藏了脚本文件,是否还有其他方法可以获取脚本文件。

Instead of inline javascript you can use external files . 可以使用外部文件来代替内联JavaScript Your code will not be in the page you are viewing, but in another file. 您的代码将不在您正在查看的页面中,而是在另一个文件中。 Of course it's not hidden from the browser. 当然,它不会从浏览器中隐藏。

Example for inline javascript: 内联javascript的示例:

<!-- index.html -->
<body>
    <script type="text/javascript">
        alert("my super secret js!");
    </script>
</body>

Example for external file javascript: 外部文件javascript的示例:

<!-- index.html -->
<head>
    <script type="text/javascript" src="your_js_file.js"></script>
</head>

/* your_js_file.js */
alert("my super secret js!");

Simple! 简单! If you see source like : <script type="text/javascript" src="xyz.js"></script> in the browser's sorce window , then click on it and it will show you your javascript code! 如果在浏览器的源窗口中看到类似<script type="text/javascript" src="xyz.js"></script>的源,请单击它,它将显示您的javascript代码!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Ajax中,如何通过脚本代码获得2个输入值? - In Ajax, How can I get 2 input values by the script code? 如何使用Java脚本获取httprequest的响应代码? - How can i get a response code of httprequest using java script? 如何在 JavaScript 中获取 a.js 脚本的源代码? - How can I get the source code of a .js script within JavaScript? 如何在文件和脚本标记中的 onload 事件中运行代码 - How can I run code in the onload event in a file and in a script tag 如何获取已加载文件的内容(带有脚本或链接) - How can I get the content of a loaded file (with script or link) 如何获取指定为“src”的文件的内容<script> tag? - How can I get the content of the file specified as the 'src' of a <script> tag? 如何从 Java 脚本获取 Json 文件数组 - How Can I Get a Json File Array From Java Script 我可以从Google Apps脚本代码文件的侧边栏中获取当前HTML吗? - Can I get the current HTML from a sidebar in a Google Apps Script code file? 我如何重构此代码以使图像文件显示在浏览器上? - How can i refactor this code to get the image file displayed on the browser? 如何使用java脚本获取异常的子代码? 像500.1 - How can I get the substatus code of the exception with java script? like 500.1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM