LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-20-2011, 08:28 AM   #1
disruptive
Member
 
Registered: Dec 2005
Posts: 76

Rep: Reputation: 15
Hiding javscript


Particulalry with HTML5, is there a way to hide the javascript? When I'm not working on opensource, I would like to be able to protect the javascript from prying and copying eyes?
 
Old 01-20-2011, 09:40 AM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Hiding javascript as far as viewing the source of the webpage? Can't really fully do that, but to help, you could keep all the javascript in a src file and load it as such.
 
Old 01-20-2011, 10:09 AM   #3
disruptive
Member
 
Registered: Dec 2005
Posts: 76

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by corp769 View Post
Hiding javascript as far as viewing the source of the webpage? Can't really fully do that, but to help, you could keep all the javascript in a src file and load it as such.
Wouldn't one find that it still gets pulled into the browser?

With, what seems the march towards HTML5 and increasingly complex offerings written in JS, I guess protection will be crucial?
 
Old 01-20-2011, 10:15 AM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,220

Rep: Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319
The standard practice is to minify it, which both decreases its download size and greatly obfuscates it.

Last edited by dugan; 01-20-2011 at 10:19 AM.
 
Old 01-20-2011, 10:15 AM   #5
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Posts: 952

Rep: Reputation: 217Reputation: 217Reputation: 217
In short, no, the details of the included file are not visible.
 
Old 01-20-2011, 10:24 AM   #6
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
True. I don't have much experience with html5 yet, so I don't know what to say about that. Maybe someone else knows anything out there...

edit - those guys beat me to it. thanks.
 
Old 01-20-2011, 10:30 AM   #7
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
As far as I am aware, it's impossible to "hide" javascript, only obfuscate it (as dugan said). The browser needs to know what the code is to run it, and so people will always be able to see it somehow
 
1 members found this post helpful.
Old 01-20-2011, 10:48 AM   #8
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Snark, thanks. I thought to myself about that one, and there really isn't any way to hide code from a browser. If it can be done, some sort of government agency knows how to do it.
 
Old 01-20-2011, 10:58 AM   #9
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,220

Rep: Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319
Quote:
Originally Posted by corp769 View Post
Snark, thanks. I thought to myself about that one, and there really isn't any way to hide code from a browser.
Sure there are. Java applets, Flash, Silverlight, and other plugins.
 
Old 01-20-2011, 10:59 AM   #10
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Yes that is true, but we are talking about hiding javascript. Of course you can use flash or java to do the same thing, but I think the OP wants to operate in just javascript. Well, unless he is willing to jump that hurdle and do it that way... :P
 
Old 01-21-2011, 09:47 AM   #11
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Quote:
Originally Posted by dugan View Post
Sure there are. Java applets, Flash, Silverlight, and other plugins.
True, but in principle the same idea applies. You would have to decompile it (and brief google searches suggested decompilers exist for all the formats you mentioned) but the fact remains that all the code necessary to run the thing is there. It just depends on how determined the person is to get at the code - but, yes, for most practical purposes you are correct
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
display image in javscript mohtasham1983 Programming 1 10-01-2007 04:44 AM
Javscript on-click not working intramaweb Programming 1 10-30-2006 01:21 PM
Hiding users from each other itskiLLjoy Linux - Security 1 03-28-2004 04:37 PM
hiding menubar new user Linux - General 1 10-01-2003 01:14 AM
Hiding tmiles Linux - Security 4 08-10-2001 08:17 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration