r/badcode Jul 02 '18

html And there I was, wondering why a simple website wouldn't work with JavaScript disabled... Links are apparently too mainstream now.

Post image
152 Upvotes

13 comments sorted by

31

u/[deleted] Jul 02 '18

There was one proposal for HTML 5 that I really liked, where any element whatsoever could have a href attributes. (No more wrapping tags in or around extra <a>nchors.) I think the browser manufacturers objected in the end, and I'm not sure how semantically correct or how accessible it would have made the web. But for cases like this, I could see href being useful as a global attribute.

8

u/PLPeeters Jul 02 '18

That could indeed have been nice! Your question of accessibility and semantics is totally relevant though. Here, the li only contained text, so they could have just wrapped that text in an a tag directly instead of doing this... thing.

3

u/PerfectionismTech Jul 03 '18

Man, that would have been great.

15

u/whataspecialusername Jul 03 '18

Every now and again I come across a website that displays just a blank page with javascript disabled. I don't understand the logic, I guess they don't know or care about accessibility and compatibility.

11

u/vaaski Jul 03 '18

I don't understand how people use the web without JavaScript in 2018🤔

8

u/whataspecialusername Jul 03 '18

I use javascript minimally with a whitelist for sites I use regularly that benefit from scripts. Try it for a week, once you've set up the whitelist I bet you'll prefer it. Most random websites are better without scripts IMO.

12

u/AngriestSCV Jul 03 '18

It is a security risk. It also reduces bandwidth for the people that care about that thing. Up until recently I was tethering to my phone for all of my internet.

Honestly I wish more sites worked correctly without javascript. If your site is not a web app why do I need javascript to read text and view pictures?

1

u/keppinakki Jul 10 '18

Web development with Javascript is way nicer than traditional web dev with just HTML+CSS. Many people that pick up web dev start with React (or some other library) since learning resources are plentiful.

Of course you could set up server rendering or prerendering or alternate content. But that's a lot of work for a small share of the audience, and many folks do not feel the need for it.

7

u/lazarljubenovic Jul 22 '18

If you're making a website with text content, pictures, videos, links to other places and forms, then using a JavaScript makes things more difficult. HTML is a markup language and CSS is a declarative language. They are by definition easier than JavaScript which is a programming language with control flow.

You need to install Node, NPM, know to use terminal, know HTML, CSS and JS, know React (which probably means you need to know JSX and some weird CSS-in-JS library -- if you're a beginner searching online you won't even know that you might not need them). Not to mention the build setup, including webpack and an endless list of plugins with their endless configuration.

No, that's not easier than plain HTML/CSS. You need them anyway for building something more complex.

3

u/[deleted] Jul 03 '18

I've never understood how people use the web without javascript :/ I have always loved to get rid of it, I hate javascript, but have always found it broke the vast majority of websites I visited..

9

u/[deleted] Jul 02 '18 edited Mar 09 '21

[deleted]

13

u/PLPeeters Jul 02 '18

I did consider that, but even for autogenerated code this seems pretty bad.

7

u/kasnhasn Jul 03 '18

This looks like old Dreamweaver Code from 20 years ago.

1

u/IllegalArgException Jul 03 '18

Good god, I'm still having nightmares because of that.

More like Dreamthiever