Click here to Skip to main content
13,247,005 members (88,914 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi
Experts,

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:

Thanks,
Imdadhusen
Posted 2-Nov-10 21:03pm
Updated 2-Aug-16 17:39pm
v2
Rate this: bad
 
good
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.
  Permalink  
Comments
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
 
good
Please Sign up or sign in to vote.

Solution 2

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

Protects JavaScript code from stealing and shrinks size


http://www.javascriptobfuscator.com/
  Permalink  
v3
Rate this: bad
 
good
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

$(window)
.off('resize.chosen')
.on('resize.chosen', function () {
$('#' + htmlSelectId).each(function() {
var $this = $(this);
$this.next().css({ 'width': $this.parent().width() });
});
}).trigger('resize.chosen');
//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);
$this.next().css({ 'width': $this.parent().width() });
});
});
};
  Permalink  
Comments
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 |
Web01 | 2.8.171114.1 | Last Updated 2 Aug 2016
Copyright © CodeProject, 1999-2017
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