Click here to Skip to main content
12,558,168 members (52,238 online)
Rate this:
Please Sign up or sign in to vote.
See more: Javascript

I put a Javascript into a JS file,and refered it in a HTML file.

This Javascript includes sensitivity information
such as the
Next page Path and File Name,
some result that will be stored in Array,
and Logic.

I know people can get this JS file information by choosing View Source Code or Download this JS file via Save As page option. so

How do i protect the JS file source?

Any idea will be appreciated!:thumbsup:

Posted 2-Nov-10 20:03pm
Updated 2-Aug-16 16:39pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I Think it's not possible to restrict JS file from downloading, You can have another alternate option to store sensitive data rather then JS.

See THIS[^] thread which might be useful for you.

Please vote and Accept Answer if it Helped.
Sunasara Imdadhusen 3-Nov-10 2:25am
Ya i understand, but i want to Encrypt JS file, so no body could read it easily.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Give read permission on that folder.
you can use following link

Protects JavaScript code from stealing and shrinks size
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

var sctvobj = {};
sctvobj.chosenSelect = function (htmlSelectId) {
$('#' + htmlSelectId).chosen({ allow_single_deselect: true });
//resize the chosen on window resize

.on('resize.chosen', function () {
$('#' + htmlSelectId).each(function() {
var $this = $(this);
${ 'width': $this.parent().width() });
//resize chosen on sidebar collapse/expand
$(document).on('settings.ace.chosen', function (e, event_name, event_val) {
if (event_name != 'sidebar_collapsed') return;
$('#' + htmlSelectId).each(function () {
var $this = $(this);
${ 'width': $this.parent().width() });
Dave Kreskowiak 2-Aug-16 22:44pm
Do NOT post "answers" to SIX YEAR OLD questions. Your answer also doesn't have much of anything to do with the question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.161026.1 | Last Updated 2 Aug 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100