2

I work well with C#. Is it possible for a web page to receive its functionality from a non-JavaScript source? If so, why is it such a common practice to use JavaScript with HTML?

1
  • 1
    Well it just depends on what the client supports. The browser is just a program that interprets what the server is sending. So if you're using an old version of internet explorer - VBScript can be used. It's a common practice to use JavaScript because it's widely supported. If you decided to make your own browser that supported some language you created - then you could use that language. Commented Aug 12, 2017 at 5:32

5 Answers 5

4

JavaScript is client-side. If you want some level of interactions in the client then JavaScript is the way to go. (You can also use JS server-side, and there are other client-side options as well, but JS is pretty much the de-facto standard for implementing client side interactions)

It's common because it's a standard. Nearly all (or all?) browsers support JavaScript these days. It was also one of the first browser-supported client-side scripting languages.

Sign up to request clarification or add additional context in comments.

Comments

2

I'm pretty sure javascript is the only thing you can use on the front end. I guess you could implement flash or something but flash is dying out and shouldn't be used on the web.

Since you say you're well-versed in C#, you might want to look into ASP.NET. I don't know that much about it, but it's on the same framework as C# (well it should be judging by the name)

Here's a little guide I found on getting started.

2 Comments

If one is using C#, they're likely already using ASP.NET (C# being one of the languages that runs on the .NET platform)
There are numerous * to JavaScript "compilers". So while technically browsers only support JS, one don't have too write it...
0

They don't have to use Javascript. But if they choose to use a client-side language, it will be Javascript. Because it's the only language browsers can run.

3 Comments

Well, not entirely true. Flash/ActionScript, for example (though admittedly, that's becoming rarer and rarer...)
@DA I understand the point you are making, but I don't think Flash is appropriate in this discussion (unless your only intention was to shed light on available technology consumable solely client side). Flash, Silverlight, etc. were surely not designed to run seamlessly with the HTML DOM. JavaScript is the only relevant language because performance is decent enough to where anything can just be transpiled to it if working with JavaScript is the pain point in your workflow. With the introduction of Web Assembly standards, I foresee this changing drastically over the next decade.
@AustinBrunkhorst yes, that was the intent...to point out that there were/are other client-side scripting languages. But I agree, in terms of DOM manipulation, JS is pretty much the leader in that respect.
0

Yes, of course, you could run just HTML and CSS without a scripting language. But, if you want to use a scripting language, JavaScript is the only one that all major browsers understand.

In the early days of browsers there were some competing scripting languages but they were all dropped for JavaScript.

Comments

0

JavaScript is an example of a Client-side scripting language where the code is actively interpreted by the browser, which means the browser has to support the scripting language you choose. In HTML, the scripting language is defined by the type attribute within the <script> tag.

As of Html5, the default language for all script tags became JavaScript. However, w3.org shows these three examples as client-side scripts in an html page:

  • text/vbscript
  • text/tcl
  • text/javascript

I would guess that almost everyone uses JavaScript because it is most widely supported by all the most popular browsers.

If you like C# or some other language, you can do something similar to server-side scripting in ASP.NET.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.