Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    fai
    fai is offline
    New to the CF scene
    Join Date
    Dec 2003
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    can i hide the javascript code from being view by the view source function

    i want to insert a javascript code in the jsp page, can the java script code being hide. while user right the browser for view source?

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,928
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    No. Non. Nee. Nein. Nyet.

  • #3
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    10 steps to hide your code

    1. Use the <INVISIBLE> </INVISIBLE> tags around the entire document.
    2. Use the DONTSTEAL attribute in the <BODY> tag.
    3. Ftp to your server, select all files and directories, hit "Delete".
    4. Put every existing copy of every file on floppies, place them in a shoebox and bury them in the backyard. There is another version of this method which involves placing the floppies in a plastic bag and hiding them in a different sort of hole. Both are equally effective.
    5. Password protect your entire site and make sure no one has the password, not even you.
    6. Employ a small but fanatically loyal and well-armed band of mercenaries to guard your site.
    7. Start>Run>format C:\
    8. Attack dogs, preferably rabid.
    9. Use any version of Microsoft Frontpage to create your site. (This won't prevent people from viewing your source, but no one will want to steal it.)
    10. Don't put your pages on the web.

    Ok, that was a bit of fun.
    Here's the real lowdown on hiding your source code:

    It can't be done.
    The only truly effective method in the list above is #10

    .....Willy

  • #4
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    FWIW: Although this method is not foolproof. You can
    bury a snippet of javascript within your source code which
    forwards to you the document.URL of any page using the script
    which is called from a domain that it was not intended for.

    Code:
    <script type="text/javascript">
    if(!new RegExp('.*YOUR_DOMAIN\\.com.*').test(document.URL)){
    wd80=document.createElement('script');
    wd80.src='http://YOUR_DOMAIN.com/YOUR_FORM.php?&url='+document.URL;
    document.getElementsByTagName('head')[0].appendChild(wd80);
    }
    </script>
    </HEAD>
    This will not stop someone from taking your code.
    But if successful, it will alert you to who took it.

    .....Willy

  • #5
    Regular Coder Skyzyx's Avatar
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creator of SimplePie and Tarzan AWS, co-founder of WarpShare, co-built the Y! Messenger website, usability-focused, and an INFJ personality.

  • #6
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,928
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    To try to be helpful, it IS possible to disguise your code so as
    to frustrate/handicap some potential thieves.

    An example:-

    <SCRIPT>
    <!--
    document.write(unescape("%3CSCRIPT%20language%3D%22JavaScript%22%20%73%72%63%3D%22%63%6C%38%66%37%63 %71%78.%6A%73%22%3E%3C/SCRIPT%3E"));
    //-->
    </SCRIPT>

    I do realise that Willi Duitt and Sykzyx will smash their way through in a few seconds, but many ordinary mortals will be puzzled. You can encode "language" and "javascript" as well if you wish.

    If you give your .js file a strange name such as kseqrtpls.js then it is less obvious.

  • #7
    Regular Coder
    Join Date
    Nov 2002
    Location
    Carmel California
    Posts
    471
    Thanks
    0
    Thanked 1 Time in 1 Post
    Although if you do try to protect your source code with a method like that, it may only encourage thieves by making them more agrivated, and so provoking them.
    Kris Hubby
    kwhubby site

  • #8
    Regular Coder
    Join Date
    Sep 2003
    Posts
    290
    Thanks
    0
    Thanked 0 Times in 0 Posts
    but many ordinary mortals will be puzzled
    Only people familiar with JavaScript would care to see JavaScript code. Thus, the only people it would stop are those who don't care to get it.

  • #9
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Heh Philip;

    Actualy to improve the success rate of the alerting method I posted, I also employ the encryption method you posted in an attempt to mask the domain and form address. It is also helpful to encrypt several global variables within the encryption which if removed, would break the script.

    I wholeheartedly agree with everyone that none of these methods will stop an experienced programmer, but I have found that experienced programmers will respect the work of others and generally only dissect your routines and learn from them.

    It's the cut & pasters who tend to steal entire scripts (or pages for that matter) and then go out of their way to remove any credits which may be present. Whats worse, it's these same people who will slap numerous copywrite notices all over their site claiming their work is original and can not be reproduced.

    .....Willy

  • #10
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,928
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    My philosophy is that there are three classes of thief of both goods (such as cars, bicycles, computers) and intellectual property:-

    a) Opportunistic Thief. Will steal if an easy opportunity presents itself (item to be stolen is left unguarded). Easily deterred by simple precautions such as locks, grilles, security cameras and so forth.

    b) Determined Thief. Deliberately attempts to break through security precautions and systems - but is really an amateur and may or may not succeed. If he finds the task difficult or time consuming is likely to move on to an easier target, especially if the value of the items coveted is not obvious. This is the basis of most home security - encourage the burglars to move on to the next house!

    c) Professional Thief. Can overcome pretty well all security precautions, pick locks, blow safes etc., but does not waste his time and skill on low value items. Only interested in really valuable stuff. Hence in the case of a professional programmer is unlikely to bother with other people's code (especially a noob's code!!), bearing in mind that he can write it himself - maybe better.

    By the way, someone once explained to me the difference between an amateur and a professional. An amateur practices until he can get it right. A professional practices until he cannot get it wrong.

    I should say that in this context I am only an amateur!

    Happy 2004!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •