how to prevent exposing java script and CSS in source code

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved

Join Date: May 2008
Posts: 74
Reputation: servis is an unknown quantity at this point 
Solved Threads: 0
servis servis is offline Offline
Junior Poster in Training

how to prevent exposing java script and CSS in source code

 
0
  #1
Dec 3rd, 2008
Hellow,

Can we prevent exposing java script and css in source code of web page on the user machine???

please if anybody know about it????

shuja
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,144
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 531
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is online now Online
Moderator

Re: how to prevent exposing java script and CSS in source code

 
0
  #2
Dec 3rd, 2008
No.

Obviously, the browser needs to be able to see the code in order to render it.
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 94
Reputation: sikka_varun is an unknown quantity at this point 
Solved Threads: 11
sikka_varun's Avatar
sikka_varun sikka_varun is offline Offline
Junior Poster in Training

Re: how to prevent exposing java script and CSS in source code

 
0
  #3
Dec 5th, 2008
Hi...
You cant hide the code in the browser if you have written it in the html/php/js/.. source file..

So in order to hide your css and javascript code, better to create its files..
for eg.. for javascript... create a file with .js extension
say: myscript.js
and write all your javascript code in it.. (without <script></script> tags ofcourse)...
And in your html page call this file..

  1. <script type="text/javascript" language="JavaScript" src="myscript.js">

The browser will only see the above line and not your js code..

For the CSS files.. create a file with extension .css : eg: style.css

And include your styles in this file..
And in the head tag, use the following code:

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <head>
  2. <link rel="stylesheet" type="text/css" href="style.css">
  3. </head>

Hope this helps you..
VâRûN
---Happy to Help---
sikka_varun@yahoo.com
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,144
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 531
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is online now Online
Moderator

Re: how to prevent exposing java script and CSS in source code

 
0
  #4
Dec 5th, 2008
yeah but people can still steal them

just put in the path

e.g

http://www.daniweb.com/forums/client...1108-00030.css
Last edited by jbennet; Dec 5th, 2008 at 8:01 am.
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 74
Reputation: servis is an unknown quantity at this point 
Solved Threads: 0
servis servis is offline Offline
Junior Poster in Training

Re: how to prevent exposing java script and CSS in source code

 
0
  #5
Dec 11th, 2008
sikka_varun thank you for your valueable solution...this is very much working.
jbennet, I think you may prevent these files path to steal by using php or some server side coding, if any body try to open the url, it send him the message "You are not allowed to view this file"...
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,144
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 531
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is online now Online
Moderator

Re: how to prevent exposing java script and CSS in source code

 
0
  #6
Dec 11th, 2008
There is no way to 100% protect it. Its simple. They have to see the code in order to run it, because it is a script.
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC