Linking to a Section in the Criminal Code

So try this: create a link to section 650 of a freely available online version of the Criminal Code. Basic law, basic task in this digital age, right?

Unless I’ve missed something obvious, which is the best sort of thing to miss, it ain’t so easy nowadays. There are two online sources of the Code: CanLII’s and the Department of Justice’s, which are actually just one version because CanLII publishes what the DOJ provides.

But let’s start with the CanLII version. There’s the whole statute with no table of contents. And that’s it. A search within for “650,” of course, turns up all manner of mentions of that number, and wouldn’t give us a usable URL in any case.

Now the federal site. Here there is a table of contents, but unless you’re a frequent user of the Code, you’re going to have to shuffle around a bit because the TOC has no section numbers, just section heads and cut lines. Stabbing at where you think s.650 might be, will bring up any old section, and if you’re persistent you’ll see that at the bottom of the “any old” page there’s a drop-down list that offers you links to groups of sections by number. So we “Go to…” “573 … 672″. Scroll down to s.650. Now what?

Well, there’s no help from the location bar of your browser, obviously, because it reads: “http://laws.justice.gc.ca/eng/C-46/page-3.html”. But if you’re adventurous, you’ll see that the number and the cutline above it are hyperlinks — to the version of the target section in the other language. Undaunted, you press on: click the number link to the French (in my case); once there, click the number link back to the English, and voila! Section 650 sits proudly at the top of my browser window, and I purloin the URL from the location bar.

Perhaps there was an easier way. Back you go to the federal beginning, where you notice a link to something helpfully identified as a “Frames View.” This takes you to a truly tempting screen, with the table of contents and section numbers in the left frame and the Code itself in the right frame. Section 650 isn’t listed — only the principal sections are listed — but this is getting closer, you think. Perhaps either of the links to ss. 645 or 655 will do, so you right click them and copy the link — only to find that you’ve wound up with this: javascript:doLink(‘bo-ga:l_XX-gb:s_645′) Ah! Frames and Javascript, the combo from hell. Clicking on 645 does in fact take you to section 645 in the main frame, but the location bar still happily announces the ineffectual “FramesView.html”, so you try the “other official language dipsy-doodle” I described above, only to find that it fails miserably in Frames View, producing a URL that does nothing but take you to the swathe of Code in which s.650 is buried.

This is nonsense. Does it need to be pointed out to the people who publish our laws that documents are constructed and now shared in digital form, with the consequence that pinpoint citation demands hyperlinks to the very section of the Code under discussion?

Granted, CanLII operates under the handicap of having to make do with what it’s given. So the burden falls, as it should, on the federal government. There is probably a good reason why frames and Javascript are used — it might assist in updating the online version somehow. But there’s no reason not to have a simple list of section numbers that are hyperlinked to the very sections for the convenience of researchers.

CanLII — and, indeed, everyone who publishes statutes and caselaw — should add paragraph links automatically to every paragraph of the document. It’s not technically difficult and it needn’t be obtrusive: a hash mark link text, for example, can be made to appear only when you mouse over the end of a paragraph. This would enable us, where no tables of contents exist, to link directly to the appropriate point within a document.

(And while I’m on this topic, let me say that it’s time for the courts to hyperlink the references in their judgments. It hasn’t been a big deal to create digital text for decades now, so the laurels are getting a bit crushed. Time to catch up.)

Because the difficulty of getting a URL for a Criminal Code section struck me as silly, I’ve taken the un-numbered federal TOC and added section numbers to it. It’s not perfect because it doesn’t have all of the section numbers, but I have simplified the URLs and outlined the fairly easy method of modifying them so as to get your target link easily. I’ve put this on a page in Slaw, where you’ll also find a link to a PDF file of the table suitable for downloading. I’ve no idea how long this hack will be effective; a change in the Code structure may make parts of this unworkable. But I hope that things can be properly mended by the powers that be before that happens.

Retweet information »

Comments

  1. Dear Simon, you won’t believe it – call it synchronicity or pure coincidence – but we planned to add this feature for some time and we are able to launch it… today. We did not even have the time to make the announcement on CanLII yet.

    In a nutshell, we now provide basic tables of contents for Federal statutes and regulations. See for instance what we did for the Criminal Code or the Access to Information Act.

    Of course you may now link to specific sections: s. 650 of the Criminal Code starts here.

    Some caveats should however be made:
    – The current tables of content are really basic ones: they only have two levels and do not necessarily reflect the text’s real structure;
    – The URLs of the sections might change in a more definitive release of this feature, and the URLs of the headings will certainly change since they are not guaranteed to be unique in the current release.

    Other provinces will follow suit where the structure of the documents can be automatically parsed with reasonable efforts.

    We hope that this will be useful, and we are already working on an improved version of this feature.

    Frédéric Pelletier, CanLII’s Editor in Chief

  2. Wow, the timing is odd. I’m very glad indeed that you guys have done this. Congratulations.

  3. The DOJ site provides a very useful “Linking guide” (access by selecting “How to Link” from Help section on sidebar) which shows you how to link to a specific section. You just need to scroll through their list of statute names and copy the URL provided, filling in the desired section number.

    So, for your example of s. 650 of the Criminal Code, the URL would be:
    http://laws-lois.justice.gc.ca/eng/C-46/section-650.html

  4. I usually click on the hyperlinked sections of the DoJ Code, which takes me to the French version. When copying the link from the French version back to the English, I get an adequate pinpoint url.
    I’m sure there are better ways, but that’s what has worked so far.

  5. Brilliant, Maureen. Thank you for pointing this out. I had the sneaking feeling I was missing something, and sure enough it was the “obvious” thing I feared.

    Omar, that’s the technique I described in my post. But both Frédéric’s and Maureen’s ways are better.

  6. Wasn’t sure if the numbers above you were referring to another link to the French, or if you were referring to the hyperlinked section numbers.
    Thanks for the clarification.

  7. I used the CanLII version of the Criminal Code last night and found a beautiful table of the sections. I found what I wanted in less than a minute.

  8. Thank you so much for bringing attention to this matter, Simon. This is a problem I have struggled with for some time, and it’s great to see some “fixes” emerging.

  9. Update on CanLII:

    We have slightly improved the TOCs for Federal legislation. The table is better structured and its hierarchy can be expanded or collapsed.

    We also changed the URLs to headings, sections and subsections to make them unique and thus more reliable. Now s. 650 of the Criminal Code starts here.