Sign in | Join
Last post 11-21-2008 4:35 AM by vaibhavgangal. 5 replies.
Sort Posts: Oldest to newest Newest to oldest
I am using asp.net with C#. I have alot of Javascript in my UserControls and WebForms. My problem is when my page is being viewed in the browser and I locate the source of my page I can see all my Javascripts. Is there a way to not show my Javascript if users view the source of my page?
You could put the JavaScript in a separate file, but the user can still download it if they access the URL. That's the way JavaScript works.
If you put all your code in a .js file and then include this file in your aspx page, that should work.
<head runat="server"> <script src="Include/Scripts.js" type="text/javascript"></script> </head>
You may include an external javascript on your code
for ex:
<script language="javascript" src="/jsfolder/script.js"></script>
In script.js you can place all of your scripts. This will still be viewable by others.
There isn't any way to hide JavaScript from client browser.
Cheers
Bhavesh
Hi,
Not possible to hide javascript code.
Take enough care that you are not exposing any important information like password on client side code.
Regards,
Vaibhav