Search code examples
javascripturluridata-uri

HTMLCanvasElement.toDataURL - Incorrectly named function?


It is, under my current understanding, incorrect to declare that a data URI is, in fact, a URL.

So, with that under consideration, would I be correct in saying that the JavaScript function HTMLCanvasElement.getDataURL() has been named incorrectly? Or is there a specific reason for why it was named the way it was.

I refer to this answer, since it states that a data URI is not a URL.


Solution

  • The WHATWG has decided that it is desirable to

    Standardize on the term URL. URI and IRI are just confusing. In practice a single algorithm is used for both so keeping them distinct is not helping anyone. URL also easily wins the search result popularity contest.

    https://url.spec.whatwg.org/#goals

    Web browsers now have a built-in, standardized URL object which is used to create Blob URLs. Say goodbye to the URI.