Web APIs are typically used with JavaScript, although this doesn't always have to be the case.

was reading the Web APIs page on MDN, and I am unable to understand one sentence: “Web APIs are typically used with JavaScript, although this doesn’t always have to be the case.”
MDN Web APIs page: https://developer.mozilla.org/en-US/docs/Web/API

From my understanding all the WebAPIs mentioned in the page are exposed through javascript by the browser for various functionality. And from my understanding for any scripting in the browser we would need to use Javascript.

What I don’t understand that the sentence mentions that the APIs are typically accessed using Javascript, but that doesn’t always have to be the case. What I understand from this is for eg. If I would like to access any of the WebAPIs using C# or Java, it should be possible. Which I feel might not be correct.

Does anyone have examples on what does this sentence mean ? Thank you!

Hi @RedPhantom and welcome to the community :wave:

They are possibly referring to APIs that aren’t only used with JS. For example the CSS Counter Styles can be used with JavaScript over the CSSCounterStyleRule Interface but also through CSS with the @counter-style rule.

Maybe another one is the WebVTT API that is used for subtitles. It can be used with JS but also with the <track> HTML tag.

In general we can think of web APIs as abstractions (simplified versions) of complex browser functionalities that are offered to us developers. Most of the time through JS, but as we saw above sometimes also directly through CSS or HTML.

At least that’s my understanding. Corrections or different opinions are welcome :slightly_smiling_face:

I hope that helps.



Hello @RedPhantom

plus what @mikoMK said you can use js in java we have this api https://docs.oracle.com/en/java/javase/17/docs/api/java.scripting/module-summary.html
it can even used for any scripting language which js is one

check this for an example https://javapapers.com/core-java/run-javascript-from-java/

beside that it possible even to use html css in java even for desktop app
check this for java desktop app with css code

hope that help and have a nice day :slight_smile:


So in the end you are still using the Web API with JavaScript in this example :stuck_out_tongue:


lool ops i forgot to mention that which is what he was asking about :joy:


Hi @mikoMK, thank you for the specific API examples. I understand the point now!

Initially I was having a though that it would be something related to WebAPIs being used in other languages conceptually. Eg. WebRTC is a WebAPI exposed through JS, but it is also implemented and available in SDKs of other languages, eg. C#, Java etc. ie. The protocol of WebRTC has been implemented in other languages. But, I was not fully convinced.

But, your specific examples from the WebAPI page have convinced me and cleared my doubts.
Thank you!

1 Like