-6

I am trying hide or encrypt my javascript code from source code.

my code is :

<script type="text/javascript">
 function getValue() {

    return "<?php echo "ab"; ?>";

}
</script>
</head>

<body>
<form name="form">
        An input field:
        <input type="text" name="input">
        <input type="submit" name="submit">
    </form>
<script type="text/javascript">

        document.form.input.value = getValue();

    </script>

Please help.

Sourav Ghosh
  • 133,132
  • 16
  • 183
  • 261
Vikash Dhiman
  • 570
  • 5
  • 16

1 Answers1

0

You can't encrypt JavaScript code from source code, but you can optimize it by using JavaScript minimizers like this:

http://www.minifyjavascript.com/

Daniel A.A. Pelsmaeker
  • 47,471
  • 20
  • 111
  • 157
Dino Babu
  • 5,814
  • 3
  • 24
  • 33