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
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
No.
Obviously, the browser needs to be able to see the code in order to render it.
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..
<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:
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
Hope this helps you..
yeah but people can still steal them
just put in the path
e.g
http://www.daniweb.com/forums/clientscript/vbulletin_css/style-c06e1108-00030.css
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"...
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.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.