Expand Cut Tags

No cut tags
ggreig: (Vacant Podling)
[personal profile] ggreig

It’s possible to do some cool things with JavaScript, but fundamentally the whole language is still an evil hack that we’re stuck with because it’s widespread, requiring clever hacks like jQuery to hide some of the unpleasantness. A prime example of hackishness – which will no doubt be fixed once they realise just how foolish it is – has  appeared on the pages of the Herald.

Premium content on heraldscotland is now only available to registered users.” Yes, indeedy, it’s true – sort of. If you visit a “premium” page full of prime journalistic content, like the letters page for example, you’ll see the whole article at first, but before you’ve finished reading it, all but the first paragraph or so will disappear.

…hang on a minute…

So, the whole page is already loaded in your browser, but you can only see part of it? View source…

Yep, the whole thing is still there, there hasn’t been a page reload or anything, it’s just been collapsed down using JavaScript. This is a form of security through obscurity (relying on the user not knowing how to sidestep it), which is a notoriously weak approach to protection.

So far, so daft. But the bit that prompted me to write was this. At the end of the “real” content of the page, there’s a noscript tag (intended for the attention of people browsing without JavaScript, the only people who’ll be able to read the entire page without hassle). It says:

You need Javascript enabled in your browser in order to view this page.

Date: 2010-12-19 11:20 am (UTC)
From: [identity profile] scottymcleod.livejournal.com
always thought of java-script as a hack we ended up with because of netscape and is has developed as hack upon hack - awful doesn't descibe it well enough but sadly it seems were stuck with it as the de facto standard

Date: 2010-12-20 01:29 pm (UTC)
ext_20894: (polar bear)
From: [identity profile] very-true-thing.livejournal.com
That is really quite stupid.

The only reason I can think of for doing it this way would be to keep the full text of the page present for search engines in order to pull in more visitors who then register. However, that runs the risk of being penalised by search engines for not showing humans the same as the spiders see.

It's not really a case of JavaScript's inherent hackiness, more a case of simply not having a clue how the web works. There's lots more in the source code that makes me want to weep.

June 2017

S M T W T F S
    123
45 678910
11121314151617
18192021222324
252627282930 

Most Popular Tags

Style Credit

Page generated Aug. 11th, 2025 05:18 am
Powered by Dreamwidth Studios