Javascript

Javascript

Postby PeterX » 08 Apr 2022, 13:47

I have said that I will investigate how to add Javascript to a small browser. I learned something and I failed. Here is why:

Javascript alone is already such a big programming framework that it is rather JS with a browser than vice versa.
Additionally to that there is Ajax, Typescript, HTML, XHTML, manipulation of the webpage, versions of JS, libraries, CSS, jQuery, PHP, SQL.

So I feel like I wouldn't succeed in programming JS for whatever browser or a new, own browser.

My personal summary: JS is evil. It hinders the democratition und decentralization of the web. Because you need large monsters like Firefox or Chromium.

Greetings
Peter
User avatar
PeterX
 
Posts: 270
Joined: 01 Oct 2020, 21:44

Re: Javascript

Postby PeterX » 09 Apr 2022, 19:18

Ok. We had this discussion about JS.
https://forum.freegamedev.net/viewtopic.php?f=24&t=8282

But my aim was not to re-"roll" rhe discussion. It was my intention to show my opinion change and about browsers in general.
User avatar
PeterX
 
Posts: 270
Joined: 01 Oct 2020, 21:44

Re: Javascript

Postby bzt » 09 Apr 2022, 19:59

PeterX {l Wrote}:So I feel like I wouldn't succeed in programming JS for whatever browser or a new, own browser.
Check out Bellard's QuickJS. Small, embeddable, easy-to-use, yet supports the full ES2020 spec. (Bellard is the guy who originally wrote ffmpeg, qemu, tinycc, tinygl and also a fully-featured PC emulator in Javascript...).

PeterX {l Wrote}:My personal summary: JS is evil. It hinders the democratition und decentralization of the web. Because you need large monsters like Firefox or Chromium.
Yes, sadly that's true. No wonder voices demanding something simpler than current HTML+CSS+JS triumvirate are getting louder day by day.

Cheers,
bzt
User avatar
bzt
 
Posts: 332
Joined: 23 May 2021, 21:46

Re: Javascript

Postby PeterX » 09 Apr 2022, 20:55

QuickJS is cool! I already knew MuJS, but QuickJS looks definitely better.

I understand that QuickJS automatizes the parsing of JS code. But I don't understand how to integrate QuickJS into a browser. I mean you must somehow take JS code as input and then call actions (in the browser or on the system). I don't understand how that works.

Edit, one more thing: Freegamedev.net's new forum (Flarum) uses not only Javascript, but Typescript, too. That's an additional evil-ness.

Greetings
Peter
User avatar
PeterX
 
Posts: 270
Joined: 01 Oct 2020, 21:44

Re: Javascript

Postby dulsi » 10 Apr 2022, 00:36

PeterX {l Wrote}:QuickJS is cool! I already knew MuJS, but QuickJS looks definitely better.

Frankly I think the javascript interpreter is probably the easy part. I've used Duktape. Super easy to embed but implementing the browser API so it can do something seems like a lot of work.

There are some examples in the quickjs repo. Documentation is also here.
dulsi
 
Posts: 570
Joined: 18 Feb 2016, 15:24

Re: Javascript

Postby PeterX » 10 Apr 2022, 05:04

Thanks for mentioning Duktape. There is also a list of further JS interpreter libs.

I agree on the assumption that if using an interpreter library then implementing the functions is the actual work.

Greetings
Peter
User avatar
PeterX
 
Posts: 270
Joined: 01 Oct 2020, 21:44

Re: Javascript

Postby Julius » 10 Apr 2022, 12:11

I think people are mixing up a largely irrational hate for Javascript, with the real problem that we let a single company (Google) and their increasingly irrelevant managed opposition (Mozilla) dominate the browser space for its own gain. Previously people were complaining about Microsoft and their Internet Explorer who where pushing even worse stuff like Shockwave and Flash and Javascript is definitely an improvement on that.

And the entire argument about complexity is also nonsense. All of computing is highly complex, at most you can try to abstract it away and try to hide some of the complexity. And just think of the complexity that is the hardware that is required to run the software in the first place.

Complexity isn't the problem with browsers... it is one company abusing their near monopoly on browser software to intentionally create a moving target so that other potential competitors feel like they have no chance to keep pace.
User avatar
Julius
Community Moderator
 
Posts: 3297
Joined: 06 Dec 2009, 14:02

Re: Javascript

Postby PeterX » 10 Apr 2022, 14:42

Julius {l Wrote}:And the entire argument about complexity is also nonsense. All of computing is highly complex, at most you can try to abstract it away and try to hide some of the complexity. And just think of the complexity that is the hardware that is required to run the software in the first place.

Complexity isn't the problem with browsers...

Sorry, but I strongly disagree. I already listed the many things that have to be coded addirionally to JS. And pure HTML is so much simpler than Javascript, or am I wrong on this?

BTW nearly no one is bashing Apple despite them being more a threat to software freedom than Microsoft.

Greetings
Peter
User avatar
PeterX
 
Posts: 270
Joined: 01 Oct 2020, 21:44

Re: Javascript

Postby Julius » 10 Apr 2022, 16:04

What do you propose as the alternative? People will not go back to simple text only browsers and dedicated mobile or desktops apps have even more complexity.

In some sense, browsers reduce overall complexity as they abstract away the underlying complexity of the OS and ChromeOS for example is overall a less complex system than Windows/Android + Chrome, which is what the majority of people use.

Apple is rarely mentioned as they have little influence outside their own devices and people stupid enough to buy them deserve little pity :p
User avatar
Julius
Community Moderator
 
Posts: 3297
Joined: 06 Dec 2009, 14:02

Re: Javascript

Postby PeterX » 10 Apr 2022, 16:55

No. I don't think nor desire that people will go back to textonly browsers. That would be too extreme and a bit silly I think. But maintainers of libre software forums could develop a bit of awareness for smaller browsers. And yes, apps are more complex, sadly.

Probably browsers really reduce complexity, especially HTML. But JS is more complex than for example a C++ system. But Windows is world champion in complexity.

And that Chrome can emulate/replace nearly a complete OS shows its complexity.

Greetings
Peter
User avatar
PeterX
 
Posts: 270
Joined: 01 Oct 2020, 21:44

Re: Javascript

Postby bzt » 11 Apr 2022, 23:34

Julius {l Wrote}:Complexity isn't the problem with browsers... it is one company abusing their near monopoly on browser software to intentionally create a moving target so that other potential competitors feel like they have no chance to keep pace.
I think PeterX is right, actually both complexity and monopoly is a problem here. Just take a look at the sheer number of specifications for web. It takes months (!) to read them all; not to implement them, but just to read what has to implemented! That's a insane and unreasonable complexity. About the second part, I totally agree, and that's exactly why people hated IE and MS, and a perfectly valid reason to hate Google too.

Julius {l Wrote}:What do you propose as the alternative?
A simple, right-to-the-case specification for representing media (text, images, videos etc.) in a structured form. If you think about it, 99.999% of the web is nothing more than nicely structured text with some images, nothing else. JS is typically used for things like popup menus, expand boxes, loading fonts and such, which could be solved in a much much simpler way than requiring an entire scripting language (and now bytecode) interpreter. As a matter fact, an interpreted scripting isn't needed at all, it's just overused all the time because it's there.

For example I never understood the complaint about the new forum's font. It turned out with JS turned off, Flarum does not load the font, so I've never seen it... Now why do you need an entire scripting language to load a font when you could just use a single CSS attribute instead?

Another example: bootstrap is using not only Javascript, but a bloated jQuery library as well to provide tab switching, however all of that complexity is totally unnecessary, and perfectly doable with pure HTML+CSS only.

Cheers,
bzt
User avatar
bzt
 
Posts: 332
Joined: 23 May 2021, 21:46

Re: Javascript

Postby Julius » 12 Apr 2022, 07:49

I think your impression of the web as perfectly doable in HTML+CSS is colored by an already niche use-case of yours. The majority of the time people spend on "websites" these days are fully interactive webapps like Discord, Reddit, Twitter, Instagram etc, that have build in chat, real-time updates and all that. You can't do that without heavy use of Javascript or a dedicated app. These things might not be strictly necessary, but they are the status quo and people will not switch to something that will be seen as a down-grade.
User avatar
Julius
Community Moderator
 
Posts: 3297
Joined: 06 Dec 2009, 14:02

Re: Javascript

Postby PeterX » 12 Apr 2022, 08:50

Julius you wrote:
Complexity isn't the problem with browsers... it is one company abusing their near monopoly on browser software to intentionally create a moving target so that other potential competitors feel like they have no chance to keep pace.

But who says that we have to keep pace?
We are free to stay away from extreme featuritis.
An AAA games studio must use the latest hot stuff on their webpage (perhaps).
But we as free/libre game devs don't need to do that.

I don't think JS is completely useless. It just puts high demands onto the browser.

Greetings
Peter
User avatar
PeterX
 
Posts: 270
Joined: 01 Oct 2020, 21:44

Re: Javascript

Postby bzt » 12 Apr 2022, 11:33

Julius {l Wrote}:The majority of the time people spend on "websites" these days are fully interactive webapps like Discord, Reddit, Twitter, Instagram etc, that have build in chat, real-time updates and all that. You can't do that without heavy use of Javascript or a dedicated app.
My point is, they could be. JS is heavily overused for literally everything just because it's already there.

If there were a simpler specification, you could still have Discord, Reddit, Twitter etc. there's nothing on those sites that actually demands a fully-featured user side scripting language. For example that simplified spec could just include a descriptive definition for periodically reloading parts (DOM elements), and voilá, no need for XMLHttpRequest and complex DOM manipulations. Everything else on those sites is just design-related, nothing more than structured text with some images.

For example, I could imagine an upgrade to the meta refresh feature, expanding it to all block elements as an attribute. For example every div element could have a "refresh" attribute, which would load and replace the contents of that div.
{l Code}: {l Select All Code}
<div refresh="freq;url">...</div>

Passing dynamic url query arguments could be solved exactly the same way as with the "form" element, no need to reinvent the wheel there either.

Anyway, all I'm saying, it could be done, it is possible.

Cheers,
bzt
User avatar
bzt
 
Posts: 332
Joined: 23 May 2021, 21:46

Re: Javascript

Postby PeterX » 12 Apr 2022, 17:55

JS is heavily overused for literally everything just because it's already there.

I think so, too. Probably Julius thinks similar (replace overused with used). It's only the question if we have to use it simply because others do so.

Greetings
Peter
User avatar
PeterX
 
Posts: 270
Joined: 01 Oct 2020, 21:44

Re: Javascript

Postby Julius » 12 Apr 2022, 22:07

bzt {l Wrote}:Anyway, all I'm saying, it could be done, it is possible.


Yes I remember websites 10 years ago that did just that, and they were terribly slow and put heavy load on the server with their constant refreshing.

Advanced single-page Javascript websites were developed as a way to have complex websites but still be efficient with server resources and load content from the server only on demand.

I am not saying that we need to rush implementing more and more features into browsers like Google is doing with Chrome, but overall I also don't think it is realistic to reduce the complexity of browsers (much). I would rather try to reduce the complexity elsewhere by slimming down the OS for example.
User avatar
Julius
Community Moderator
 
Posts: 3297
Joined: 06 Dec 2009, 14:02

Re: Javascript

Postby bzt » 13 Apr 2022, 14:19

Julius {l Wrote}:Yes I remember websites 10 years ago
You misunderstood. What I have suggested as an alternative, was never actually made nor implemented, so there's no way you could remember that.

Julius {l Wrote}:they were terribly slow and put heavy load on the server with their constant refreshing.
FYI, 10 years ago the infrastructure had smaller throughput and the servers were slower. I can assure you, today's XMLHttpRequest heavy websites produce a much higher load than the ones 10 years ago, you just don't notice because servers become stronger. Plus the server can always return "304 Not Modified" (RFC 7232) response to minimalize the net-traffic, regardless how the url was queried (http refresh, meta refresh, XMLHttpRequest. or with my suggested refresh attribute).

Julius {l Wrote}:Advanced single-page Javascript websites were developed as a way to have complex websites but still be efficient with server resources and load content from the server only on demand.
That's not entirely true. First, loading content from the server (XMLHttpRequest) is just a small part of Javascript, and second, modern pages do not use on demand loading, they are asking for data at regular intervals (true for Discord, FB, Twitter etc. just check out the "Developer Console" while you visit these pages). It is the server who answers with an empty response when there's nothing changed, but there is always a client initiated request first.

Julius {l Wrote}:I am not saying that we need to rush implementing more and more features into browsers like Google is doing with Chrome, but overall I also don't think it is realistic to reduce the complexity of browsers (much). I would rather try to reduce the complexity elsewhere by slimming down the OS for example.
That's funny, because the most complex part of any OS is the browser ;-) But yeah, I totally agree.

Cheers,
bzt
User avatar
bzt
 
Posts: 332
Joined: 23 May 2021, 21:46

Re: Javascript

Postby PeterX » 13 Apr 2022, 14:34

but overall I also don't think it is realistic to reduce the complexity of browsers (much)

Well then you focus totally on 3 browsers. There are plenty of browsers out there that are different than these 3 ones. Why add stuff only for these 3 without need? (I mean okay if it doesn't work without JS then use it, but most site work very well without JS.)

Greetings
Peter
User avatar
PeterX
 
Posts: 270
Joined: 01 Oct 2020, 21:44

Re: Javascript

Postby lm » 07 Jul 2023, 16:07

So what about using Gemini as a viable alternative to the World Wide Web and HTML/CSS/JavaScript? There are already people using it and sharing information with it. The Gemini browsers like Lagrange are a lot less complicated than a full featured web browser.
lm
 
Posts: 10
Joined: 27 Feb 2019, 15:06

Re: Javascript

Postby freem » 01 Aug 2023, 21:53

While this is true, the problem about gemini is: it's rather unknown, so a gemini capsule for this forum or the wiki is likely to be even less used without a web frontend.
It's also a lot less sexy, so it won't attract new users, which is the goal of the new forum.

Ideally, you'd need a database shared between the gemini and the www forums, possibly the same for the wiki. Then, and only then, you'd have a chance to convert people.

Gemini notably suffers from a lack of search systems (aka: google, bing, duckduckgo, and all those that olders might remember of) which is the reason why I don't use any of the clients.
By design, I personally doubt gemini can be used to make a comfortable forum, though, but please prove me wrong.
freem
BN Moderator
 
Posts: 106
Joined: 18 May 2015, 19:38

Who is online

Users browsing this forum: No registered users and 1 guest

cron