ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm trying to understand/learn how a web application can do computations at the client-end. I've been reading up on possibilities and as I understand things, the only way one can do client-side computing is via Javascript. Am I right about this? I browsed through other scripting languages and it appears that most of the others can be invoked only on the server-side via say CGI. Are there any other possibilities for client-side computing? Much as I try to follow up material on the web, I'm drowning in the acronym soup out there, and it's getting harder to process/evaluate all the info out there. Any tips/guidance would be most helpful. Thanks!!
You can do client side programming of "web" in any language you like.
You're thinking "browser" I guess - but consider applications like wget or any kinds of spiders written in Perl's LWP, or proxies or the WebDAV-support of subversion.
Many tools speak HTTP and send requests to a webserver and retrieve a response, there doesn't always have to be a browser like Firefox involved.
Anything sending a HTTP (or HTTPS for that matter) request to a webserver is a client - if you like, you can speak HTTP to a server by hand connecting to port 80 via telnet and simply typing GET index.html (just an example).
If you're asking for languages which can be called from within the realm of your browser, that would be most of the time JavaScript, because most contemporary browsers do have a JavaScript interpreter included and JavaScript is designed to do all the DOM-handling stuff.
Theoretically, you could program a Python, Perl, Lisp, Whatever interpreter for Firefox which (hopefully obeys security issues and transforms the DOM tree and so on and acts the same way JavaScript does now.
Thanks Su-Shee. Thanks for the correction, yes, I was thinking of the browser as the client. So if I want to use the browser, and want to "program from within the realm of a browser" (nicely put), I would have to use Javascript. I guess your hearty grin on your closing statement tells me that "you've done it"...I think I wouldn't have the necessary skills to write an interpreter, but if you know of some open source effort or where I might learn of such an effort I would certainly appreciate a link or two. This would be mainly to further my understanding of possibilities. Thanks a ton for your response. Do appreciate it.
No, my grin means "I've never seen anyone who really ported Python into Firefox".
Yes, inside a firefox, you have to use JavaScript. That's not bad, though, it's handy programming language, very well documented and not that hard to learn AND:
Remember what you can do if you don't consider Firefox/Mozilla as "just a browser". Strictly speaking, a today's mozilla is an entire development environment with GUI and styling options and complete network support included. Oh, and it runs under Linux, Mac and Win. Oh, and you can add new own bindings. Oh, and it understands SVG...
Think of Thunderbird, Songbird and Komodo - all based on Mozilla, all written in (as least partly) JavaScript with XUL.
Don't think less of JavaScript and of Mozilla combined with JavaScript in particular.
Don't forget java and flash. Both can do client side computing, within the scope of a browser.
Of course, you can only do client side computing at all if the user permits the scripts to run. Myself, I normally won't allow them to run. Actually I have a whitelist of sites that can run scripts; any site not on the whitelist can't run scripts.
The internet-capable versions of my software package do a peer to peer client/server networking thing, where who is the client and who is the server varies from transaction to transaction. It does a LOT of client-side computing, but of course the user has agreed to that by installing the package and the user knows about it. Also, I don't use the web or a web browser.
Thanks jiml8. Thanks for the tip on Java & Flash. At this stage since I'm only experimenting, the user permission won't matter, later if I manage to make some headway, my target group will be an internal/lan group, so once again it will be manageable. May I inquire whether your application does a lot of number-crunching & visualization? And if so, what would be your recommendation amongst the 3 possibilities - Javascript, Java or Flash? Thanks.
Again, I don't use the web or a web browser. Hence, I am not using javascript, java, or flash for my application. It implements a distributed database across the internet and is designed to maintain data consistency among far-flung nodes while minimizing the amount of data that needs to be transferred across the internet. Most of the communications are database queries and the results of those queries.
Thanks jiml8. Thanks for the tip on Java & Flash. At this stage since I'm only experimenting, the user permission won't matter, later if I manage to make some headway, my target group will be an internal/lan group, so once again it will be manageable. May I inquire whether your application does a lot of number-crunching & visualization? And if so, what would be your recommendation amongst the 3 possibilities - Javascript, Java or Flash? Thanks.
First, Java and Flash are only available if the user installs the Flash plugin and/or has (at least) a Java Runtime Environment which is basically a library to be loaded from within the plugins-directory of Firefox.
You can't be sure the user has those two. Even if they have a Java JRE, many disable Java in Firefox. And many prohibit every Javascript action besides checking if the form has been correctly filled in. And _WEB_pages which could only be used and even just seen with Flash.. *censored*
And JavaScript itself can easily be disabled in browsers - so even that is not available to you any time and in any browser.
Good webprogramming is very defensive programming - assume nothing, tolerate everything and don't force the user into anything.
Don't rely on Java or Flash and make sure everything can be used and seen with JavaScript disabled.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.