31

I'm a freelance web developer building a site for a client. I found some code I'd like to use on CodePen which uses the MIT License. As far as I understand the license, I can use the code freely on my client's project so long as I reproduce the MIT License with it.

The code I'm using is comprised of a combination of HTML, CSS, and JavaScript code, which would all reside in different files. How do I include the license in this case?

I see three ways, which I'll list in order of my preference:

  1. Comment out the license before each section of relevant code in their respective files. The drawback of this is it isn't obviously visible to the public, so I'm not sure if that is enough. You would need to look at the source code to see it, which not many people do unless you're a developer. This would be most desirable for client as it would be "behind the scenes" so to speak.
  2. Create an acknowledgements page with the license referring to the specific code
  3. Write the license on the page in which the code appears.

Which, if any of these, is the most appropriate location?

3
  • Where would you recommend this be moved? Edit: Also, I think formatting is inseparable from compliance with the law. If the license is in the wrong place, I could be in violation of the law
    – Tom
    Dec 11, 2017 at 20:40
  • Agree that website formatting does impact the viability of some contracts.
    – Pat W.
    Dec 12, 2017 at 0:27
  • 1
    Note - You must also reproduce any relevant copyright information when using MIT-licensed software. Example: Copyright (c) 2017 Joe Schmoe. The copyright information is usually included in the same file as the license text though.
    – airfishey
    Dec 12, 2017 at 19:51

2 Answers 2

22

I'm surprised this question doesn't come up more often. It's a tricky issue, and one that is highly open to interpretation.

Disclaimer: I am not a lawyer.

There is not a lot of specific guidance on this issue, but a well-researched overview of the topic was published by The International Free and Open Source Software Law Review, titled "Open source licensing notices in Web applications."

On that page, the author (Arnoud Engelfriet) discusses different means of satisfying license clauses for open source licenses, and some consequences if it's not done correctly. With respect to the MIT license and its requirement to be displayed, Engelfriet has this to say:

This requirement makes it hard to comply without actually including the verbatim text of the license in the Javascript file. We could follow the same approach as with the BSD license and interpret “shall be included” as “must not be removed” but the use of the active verb ‘shall’ makes this a harder interpretation.

The author draws this conclusion:

There is a very real desire to not include full open source license texts in Javascript files when those are downloaded by browsers. For distributions of Javascript projects in original form (with source code, documentation etcetera) this issue is less apparent, as the overhead of a single license file is small.

Virtually all projects that use open source and Javascript in practice simply refer to the license text as hosted on their own website. I found no project that actually copied an open source license text in a Javascript file.

Most open source licenses do not provide obstacles against this practice. As long as the license is identified and available by URL, one may consider this as adequate notice. I therefore conclude that authors of Javascript files can license by including a reference to the license and a URL where the license text can be found.

He ends the article by providing sample text for a possible short form and long form attribution notice, to be included in the file header.

Based on this article and on other Stack Exchange questions about the same subject, I would say (in my non-lawyerly opinion) that if you can reasonably accommodate it, the first option you listed in your question is the best one. However, if you went with option #2, you would probably be fine, as it seems others have taken that same route.

1

If you're licensing source code, it would make sense to code the license into the source, which anyone can view with a simple browser command, right? You would also be well advised to reference (if not also reproduce) the license in displayed text, perhaps referencing the details to be found in the source of that page, or wherever you have encoded it, if not also a link to its source (as required in CC-BY licenses).

3
  • 2
    Will you please elaborate on what you mean by "code the license into the source"? You make the claim that anyone can view the license with a simple browser command, but if the license is in comment in a HTML file, I highly doubt my grandma would be able to find it.
    – airfishey
    Dec 12, 2017 at 19:56
  • @airfishey "code the license into the source" is to include the license info into source file usually as comment at the top of the file. I think that this is enought but removing that comment is violation of copyright license (I've had this one or twice on my projects). And if someone don't know that the website is using the library he don't need to know what license it have, I think that there is not requirement that website share info what libraries it uses.
    – jcubic
    Sep 1, 2019 at 19:30
  • @jcubic Yes, if airfishey's grandma doesn't know about the "display source" button on her browser, she certainly doesn't need to see comments containing the URL for the license.
    – Upnorth
    Sep 3, 2019 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.