2

I have all my javascript / jquery functions in a separate files, and need to prevent users from accessing this file. How can I do it ? Currently they can have a look at the source of the page and click on the following address to have access to this file.

My code is using the following line to have access to external functions on myfile.js file.

<script src="../myfiles/myfile.js"></script>

I do not want to deactivate double click on the page.

6
  • one way is that to restrict mouse right click and run your project in window also disable toolbar Commented Aug 23, 2013 at 5:26
  • @shreyanshjogi any other method ? I am not interested in that. Commented Aug 23, 2013 at 5:30
  • 4
    This is a really common question and in general it's impossible. If a user's browser can see a file, so can the user. You can read more here: stackoverflow.com/questions/2222355/how-to-hide-javascript-code Commented Aug 23, 2013 at 5:30
  • 3
    Why do you want to keep it private? If you simply don't want to show your code, you could obfuscation but it won't prevent somebody to understand your code. Just make it harder. Commented Aug 23, 2013 at 5:33
  • 2
    If it's online; it's public. Commented Aug 23, 2013 at 5:52

1 Answer 1

1

One way might be by using JS Encryption, so users reading your code won't be able to interpret it easily. Read more on http://javascript.about.com/library/blencrypt.htm

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.