Gavin Greig (ggreig) wrote,
Gavin Greig

JavaScript foolishness

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.

Tags: horror, information technology, software development, thought

  • A March for Independence (in April)

    On Saturday, YES North East Fife organised a march across the Tay Bridge from Fife to Dundee followed by a rally in the City Square. It was…

  • State of the Union

    Two and a half years ago, almost to the day, I stopped blogging on political matters as the argument I cared about was over for the time. My last…

  • 20 Years

    On the first of October, it was 20 years since I started work at Insights, and today I got my fourth block signifying a period of 5 years…

  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.