SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict say's Avatar
    Join Date
    Sep 2003
    Location
    At work
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Enforce License Control

    is it possible to enforce license control in javascript? Like only specific domain may use this javascript application?

  2. #2
    SitePoint Aficionado JVLB's Avatar
    Join Date
    Jan 2002
    Location
    N 44 56.537' W 123 3.683'
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure off the top of my head, but I think you could use the .htaccess file of the Apache server to prevent a .js file from being downloaded by another domain. Does that address your needs?

  3. #3
    SitePoint Addict say's Avatar
    Join Date
    Sep 2003
    Location
    At work
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Jvlb,

    what I mean is, if I were to sell my javascript application, how can I make sure my javascript application only run on that specific domain and not other? Thanks

  4. #4
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    No, you cannot.... Javascript is visual and cannot really be encoded so it would not work. Anything you put into it to try and enforce it can be easily removed by a determined thief.
    Wayne Luke
    ------------


  5. #5
    SitePoint Addict say's Avatar
    Join Date
    Sep 2003
    Location
    At work
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Luke, yes I understand that it can be remove. But let's just presume they can't, so how do I check the domain running the script is correct?

    Eg: if( domain != 'http://www.example.com' )

  6. #6
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Wayne Luke
    ------------


  7. #7
    SitePoint Evangelist
    Join Date
    Sep 2003
    Location
    San Diego, CA
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's a script that will find the domain name...
    Code:
    <script language="javascript">
         //do not include http or www
    theDomain="someDomain.com"
    if(document.domain.indexOf(theDomain) > -1){
         //corrrect domain
    }else{
        //wrong domain
    }
    </script>
    You can go to http://scriptasylum.com/tutorials/en...de-decode.html, and somewhat encode it...but it can easily be decoded.

  8. #8
    &#083;itePoint Aficionado JVLB's Avatar
    Join Date
    Jan 2002
    Location
    N 44 56.537' W 123 3.683'
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just postulating here, but perhaps you could place a .js file on your server and limit access to the domains of paying customers. In the .js file you could have a key (like a global variable) that allows the script to run.

    While this wouldn't be too hard to break, it might allow another level of security. Bear in mind it would slow things down and, unless your server was very dependable, you might have some unhappy customers. Alternatively, you could place the restricted directory on the client's server and handle the propriety of the source in your license.

  9. #9
    SitePoint Addict say's Avatar
    Join Date
    Sep 2003
    Location
    At work
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wow, really appreciate for all your replies and suggestion! Gonna try some stunts with js now


Bookmarks

Posting Permissions

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