Firebug, JQuery and Kludge

 Last updated: March 14, 2013

Have you had a good look at what's been coming into your browser lately? I was moved to do so recently when Michael Geist posted (March 7, 2013), on his blog (, "Forget Fair Dealing: National Post Seeks $150 To License Short Excerpts". The title pretty much tells the story. Prof. Geist was surprised to be asked for money when he used his mouse to highlight some text in the article by Chris Selley, "Full Pundit: You can't say that in Canada" ( On March 12, 2013, Prof. Geist posted a followup, "National Post Appears to Drop Fair Dealing Licensing System". I highly recommend Prof. Geist's post--the comments too--to anyone interested in copyright and the future of the news business.

I went off on a tangent. Neither the first nor the last time. I wanted to know what, exactly, the National Post was doing on this web page. I won't keep you in suspense. It was "just" a Javascript-driven popup. If you'd disabled popups, or scripts generally, you wouldn't have been able to share Prof. Geist's experience.

What might still surprise you, though, is that even though we would ordinarily be interested in Chris Selley's words, they are only a very, very small proportion of the work that is delivered to your browser when you follow that link. Would that be a factor in the analysis of the fair dealing/fair use issues? I hope so. It won't be, though, if lawyers and judges never have a look under the hood too see what's there.

When I emailed this post of mine to Simon, it was very, very small. Before Simon got his hands on it, it was just my words and a few brief excerpts from the web page. Mostly English words, with a modest amount of markup and some script fragments. That's because I wrote it in XHTML. Neither style nor script is needed for something as simple as this. If you want to see, look here. It could have been even simpler if I hadn't needed to keep Wordpress in mind.

It's because Simon has to manage all of us that he uses Wordpress. That's where all the kludge comes in. The National Post uses Wordpress too. I'm not being partisan. Drupal and Joomla are just as kludgy. If you used something like Microsoft Word to create a web page, you'd produce something unspeakably kludgy that way too. Of course, it's not that evil software is trying to take over the world. Not yet, anyway. These things pretty much have to be kludgy to do what they're trying to do. As usual, the problem is the humans.

If you want to see the kludge, 1. view 2. page source (on Firefox) is only the beginning. (Other browsers have equivalents.) You'll see this, which is Javascript:
  <script type="text/javascript">
    /* ![CDATA[ */
      if ( 'function' === typeof WPRemoteLogin ) {
        document.cookie = "wordpress_test_cookie=test; path=/";
      if ( document.cookie.match( /(;|^)\s*wordpress_test_cookie\=/ ) ) {
    /* ]] */

You'll also see lines which fetch much more Javascript than you can see with 1. view 2. page source. For example, there's:
  <script type='text/javascript' src=''></script>

Another important one in this case was:
  <script type="text/javascript" src="//"></script>

There are many more.

Javascript is a scripting language. You use it to write little programs. It's incredibly useful, when you actually do need it. See, for example, this Slaw post. Javascript is the J in Ajax. It's everywhere.

The standardized version of Javascript is ECMAScript. The latest news about developments is in this press release: "ISO/IEC and Ecma International ratify 'ES5.1', the latest ECMAScript specification of Ecma International" (June 30, 2011,

The "rights" system the National Post uses is iCopyright. I didn't save any complete copies of the original posting that Prof. Geist encountered--of course, I wouldn't!--so I can't now say exactly how they did the popup. It's not really a big mystery though.

One of the best ways to look for interesting scripts is with Firebug. In the ordinary course of events, the scripts are loaded into your computer when you go to the page. That's just how these things work. All Firebug does is to make it easier for you to read those scripts. Maybe some of you will remember that I've discussed Firebug here on Slaw before.

There are versions of Firebug for browsers other than Firefox. A similar product which comes with Firefox is Inspect Element (Q). No doubt there are other products for different browsers.

Scripting is a lot of work. You have to be very attentive to detail. You may decide to re-invent the wheel for esthetic reasons. Or as an exercise, out of curiosity. You wouldn't want to re-invent the wheel if you were busy. Instead, you'd use a Javascript library. There's a nice Wikipedia article on the idea of a "library" in computing. People sometimes call it "boilerplate" in computing too. The use of libraries in computing presents a lot of the same issues as the use of boilerplate in law. That's where a lot of the kludge comes from, in both disciplines.

Probably the most popular Javascript library is JQuery. It's free and open source. In addition to the project site, and the core site, there's a useful Wikipedia article. There are tutorials at Here, for example, is a simple demo showing how JQuery can be used to respond to mouse events.

There are JQuery plugins too. For example, here's the demo page for one of the word and character counter plugins listed.

The National Post site makes extensive use of JQuery. In general, it uses version 1.7.0. The iCopyright part also loads version 1.4.2 for the one-button-toolbar. For the toolbar, look under the article title, to the right of Chris Selley's name, where it says "Republish Reprint".

With Firebug installed, you can just right click on the icon to read the Javascript. You'll discover that it's within
  <body ... >
    <div id="npWallpaper">
      <div id="npContent">
        <div id="npContentMain">

OK. Maybe there's nothing very interesting there anymore. And you'd need to inspect a number of other scripts to get the whole picture for this page. My point really is that Firebug and similar products can be used to look for these things when they are interesting. The site does use "target=_blank" for the popup. That's deprecated in XTHML 1.0, though not in HTML 5. For the better way, and a good discussion, see "Why you shouldn’t use target=_blank, and what to use instead" (February 10, 2011,

The bigger point? Look at how many different scripts are sourced on this page. The National Post has put an awful lot of kludge into your browser for the sake of a relatively few words by Chris Selley. It's something to keep in mind.

The End