简体   繁体   中英

How can i get the code of script file?

We are developing a web based application. 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 . 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:

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

Example for external file 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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM