Hide javascript codes

Last post 11-21-2008 4:35 AM by vaibhavgangal. 5 replies.

Sort Posts:

  • Hide javascript codes

    07-18-2008, 8:33 AM
    • Member
      173 point Member
    • WhoIsPrime
    • Member since 01-28-2008, 7:01 PM
    • Posts 263

    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?

    Don't forget to click "Mark as Answer" on the post that helped you.
  • Re: Hide javascript codes

    07-18-2008, 8:44 AM
    Answer
    • Star
      7,995 point Star
    • MelvynHarbour
    • Member since 06-06-2008, 9:33 AM
    • Cambridge, UK
    • Posts 1,288

    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.

  • Re: Hide javascript codes

    07-18-2008, 8:45 AM
    Answer
    • All-Star
      21,097 point All-Star
    • bullpit
    • Member since 06-29-2006, 3:59 PM
    • Posts 4,665

    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>
     Here, Include is the folder name.
  • Re: Hide javascript codes

    07-18-2008, 8:46 AM
    Answer
    • Member
      196 point Member
    • cmsonnet
    • Member since 07-14-2008, 7:50 AM
    • sydney
    • Posts 33

     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.

    Cheers
    Andy

    Remember to mark this as answered if this solved your problem
    http://www.dnnpages.com
  • Re: Hide javascript codes

    07-18-2008, 12:55 PM
    • Member
      413 point Member
    • lad.bhavesh
    • Member since 06-14-2007, 7:10 AM
    • Posts 106

    There isn't any way to hide JavaScript from client browser.

     

    Cheers

    Bhavesh

  • Re: Hide javascript codes

    11-21-2008, 4:35 AM
    • Member
      39 point Member
    • vaibhavgangal
    • Member since 09-25-2007, 4:27 AM
    • Mumbai
    • Posts 32

    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

     

Page 1 of 1 (6 items)