JavaScript foolishness
Dec. 19th, 2010 11:10 amIt’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.