SitePoint Sponsor |
|
User Tag List
Results 1 to 8 of 8
Thread: Prevent viewing javascript code
-
Jan 11, 2007, 00:19 #1
Prevent viewing javascript code
Is there any way to prevent viewing javascript code? If you browse any .js file it will show content of that file. As for example type this url http://www.googleadservices.com/pagead/conversion.js . You can view content of that .js file. How can i prevent to display content of .js file?
-
Jan 11, 2007, 00:28 #2
- Join Date
- Jul 2006
- Posts
- 151
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You can't. If you want a user to be able to use Javascript on your page, then when they come to view your HTML page, their browser will download the JS, and there will be a way to view the JS in the cache of the browser. Firefox has an extension which is specifically designed to allow you to view external JS.
However, you can download a Javascript compression tool, and realistically Javascript that has been compressed (where all of the variables have been renamed to things like x1, x2, x3, etc...) is extremely difficult to read and will prevent 99% of people from being able to reverse engineer your script.
Also, I believe IE has a Javascript encryption tool available, but then your JS will only work in IE.
Dave
-
Jan 11, 2007, 00:59 #3
- Join Date
- Jan 2001
- Location
- chennai , tamil nadu , India
- Posts
- 710
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Here is one example of Html and Javascript encryption and Javascript and html decryption
Chris, Programmer/Developer,
Laravel Php Developers, Ruby on Rails programmers,
Moodle, Opencart, Magento, Geodesic Classifieds/Auctions,
www.chrisranjana.com
-
Jan 11, 2007, 01:00 #4
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
Jan 11, 2007, 02:47 #5
- Join Date
- Apr 2006
- Posts
- 802
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Don't be ashamed of your code- it may seem ugly and embarassing to you,
and maybe it is, but everyone has to start somewhere.
The secret is to keep improving it, and have the last laugh on whoever it is that's using your old code.
-
Jan 11, 2007, 03:20 #6
-
Jan 11, 2007, 04:05 #7
-
Jan 11, 2007, 06:04 #8
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It was not a 'prank message' and I could not possibly care less about post count. I wouldn't use a word like 'seriously' in a prank, would I?
I am trying to tell you the truth: you cannot prevent people from seeing your JavaScript code. Why? Because browsers need to 'see' it to run it, and if browsers can see it, so can people.
You can obfuscate the code to make it more difficult to read for humans, but that will merely slow thieves down a bit. I will not 'prevent' theft.
Don't blame the messenger if you don't like the message. Staff members have feelings too, you know.Birnam wood is come to Dunsinane
Bookmarks