Hide JavaScript?

Discussion in 'JavaScript' started by Num Lock, Dec 31, 2007.

  1. #1
    I have a code on my site that and I don't want it to be viewed from source, not because its malicious or anything of that nature, it's just a unique script and I don't want anyone to steal it.

    Is there anyone to hide this script, maybe have it run within a PHP file??

    Any idea I would appreciate. :)
     
    Num Lock, Dec 31, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    You can't. If the browser can read the script, anyone else can too.


    End of discussion. Sorry.


    (There are only ways to make it harder to get, but you can't make it impossible)
     
    nico_swd, Dec 31, 2007 IP
  3. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Good read: http://www.webdeveloper.com/forum/showthread.php?t=26841
    Also check out the links at the bottom.

    I wouldn't be so sure.


    And hiding it will just make things worse:
     
    MMJ, Dec 31, 2007 IP
  4. Num Lock

    Num Lock Active Member

    Messages:
    1,802
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    80
    #4
    That's true, I'll just have the script redone in PHP
     
    Num Lock, Jan 1, 2008 IP
  5. renlok

    renlok Well-Known Member

    Messages:
    457
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    110
    #5
    this may be of use
    developertutorials.com/tutorials/php/hide-your-javascript-with-php-050419/page1.html

    except you should check if the session is set instead of the variable as that wouldn't work.
     
    renlok, Jan 1, 2008 IP
  6. temp2

    temp2 Well-Known Member

    Messages:
    1,231
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    150
    Digital Goods:
    2
    #6
    you can use a soft to encrypt your code or use this tool :D
     
    temp2, Jan 2, 2008 IP
  7. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #7
    That software doesn't encrypt, it just escapes. I could bypass it easily. :rolleyes:
     
    MMJ, Jan 2, 2008 IP
  8. techrn

    techrn Peon

    Messages:
    81
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Put the js in a separate file and call it by <script type="text/javascript" src="js/filename.js"></script>. That seems to hide it from the source.
     
    techrn, Jan 4, 2008 IP
  9. Num Lock

    Num Lock Active Member

    Messages:
    1,802
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    80
    #9
    Ahh good idea, thanks!
     
    Num Lock, Jan 4, 2008 IP
  10. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Dude, seriously, no offense, but you just really embarrassed yourself. :)
     
    MMJ, Jan 4, 2008 IP
  11. godkillah

    godkillah Guest

    Messages:
    34
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #11
    you can use php the stop people from accessing the file and with the unescape/escape functions you can encrypt it

    hope it helps :)

    regards
    -GK!
     
    godkillah, Jan 6, 2008 IP
  12. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #12
    unescape/escape is easily bypassed guys; come on!
     
    MMJ, Jan 6, 2008 IP