Author Topic: Anyone know HTML? Does this BBC code make sense?  (Read 664 times)

0 Members and 1 Guest are viewing this topic.

Offline Matamore!

  • Hero Member
  • *****
  • Posts: 4,118
    • View Profile
Anyone know HTML? Does this BBC code make sense?
« on: November 05, 2014, 10:25:59 PM »
So far I\'ve managed to get the information I need from the BBC website without knowing anything about HTML, XML, etc.

I\'ve just run into something which confuses me, but which may have a perfectly logical explanation (unlike many other things about the BBC website - which, however, I won\'t bother to moan or rant about!).

Some \"episode guide\" pages, such as this one (edited, as usual, to stop the Phorum software from hiding the URL):

BBC Radio 6 Music - 6 Music Live Hour - Episode guide
Code: [Select]

http: //www.bbc.co.uk/programmes/b00rwm3t/episodes/guide


are just lists of 30 episodes.

Other \"episode guide\" pages, however, are lists of 30 lists of episodes. Example:

BBC Radio 4 - 15 Minute Drama - Episode guide
Code: [Select]

http: //www.bbc.co.uk/programmes/b006qy2s/episodes/guide


Take one of the 30 lists in this list, for example \"The Book of Strange New Things\".

It has two active links (URLs):

(1) The Book of Strange New Things

(2) View episodes

The first of these two URLs looks like this:

Code: [Select]

http: //www.bbc.co.uk/programmes/b04lhh4s


If you go there, you get a page which looks like a page for the last of the 10 episodes in the series, but which is actually distinct from the page for that episode, to which it gives a link:

BBC Radio 4 - 15 Minute Drama, The Book of Strange New Things, Episode 10
Code: [Select]

http: //www.bbc.co.uk/programmes/b04l3gm8


Page (1) also has links labelled \"Home\" and \"Episodes\" - but these actually point to the home page and episode guide page for the whole of 15 Minute Drama.

So it\'s not at all clear, at least to me, what purpose page (1) serves, or what logical category it is supposed to fit into.

But never mind, that\'s not what I\'m really worried about.

(Except that it is yet another example of the endlessly confusing nature of this whole area of the BBC website - which still mystifies me even though I\'ve just spent months writing thousands of lines of Python code to extract information from it so that I can listen to Web radio in the way that used to be simple and straightforward in the days of Radio 7 and the messageboards!).

So let\'s forget about page (1) (unless someone can enlighten me as to the purpose of pages like that), and go to page (2).

Its URL looks like this:

Code: [Select]

http: //www.bbc.co.uk/programmes/b04lhh4s/episodes/guide


This, at least, is useful and comprehensible: it is another \"episode guide\" page, consisting of a list of episodes (just like the one for 6 Music Live Hour, above). And I will probably not have too much trouble writing Python code to look at such pages, and find broadcast dates for episodes (now annoyingly missing from all pages listing episodes available to \"Listen Again\" ).

Suppose, like most people, you\'re not interested in writing Python code to access episode lists, but just click on the link (2).

Try it and see.

(To be precise, I mean: click on the link provided to \"View episodes\" for the series The Book of Strange New Things on the episode guide page for 15 Minute Drama - see the URL for this, above.)

Instead of opening the indicated URL in your browser in the usual way, it expands the list of episodes for The Book of Strange New Things \"inline\", as it were; and the address window of your browser shows, instead, this URL:

Code: [Select]

http: //www.bbc.co.uk/programmes/b006qy2s/episodes/guide#b04lhh4s


This looks (at least to my ignorant eye) exactly like the URL for an \"fragment\" of the web page where we have just clicked on the link, i.e. the episode guide page for 15 Minute Drama as a whole.

But if you examine the HTML code for that page, you find that there is no such fragment.

This is not surprising in itself, because the whole point of organising the episode guide page for 15 Minute Drama as a \"list of lists\" instead of a single list is presumably to avoid creating simply huge HTML pages.

It may not look like it, but we are actually viewing (part of) another web page within the episode guide page for 15 Minute Drama, without appearing to leave it.

My question is whether is is either normal practice, or indeed good practice, or whether it is a rather naughty and confusing trick, peculiar to the BBC.

Being ignorant of Web design myself, I did a little bit of half-hearted Googling, and found this:

html5 - HTML Anchors with \'name\' or \'id\'? - Stack Overflow

Quote
Answers

According to the HTML 5 specification, 5.9.8 Navigating to a fragment identifier:

   
Quote
For HTML documents (and the text/html MIME type), the following processing model must be followed to determine what the indicated part of the document is.

        Parse the URL, and let fragid be the component of the URL.
        If fragid is the empty string, then the indicated part of the document is the top of the document.
        If there is an element in the DOM that has an ID exactly equal to fragid, then the first such element in tree order is the indicated part of the document; stop the algorithm here.
        If there is an a element in the DOM that has a name attribute whose value is exactly equal to fragid, then the first such element in tree order is the indicated part of the document; stop the algorithm here.
        Otherwise, there is no indicated part of the document.


So, is it proper, within HTML5 or any other specification or (open) standard, to make something that is not a fragment of an HTML page appear as if it is a fragment of an HTML page?

(As I say, there may well be a perfectly logical explanation; my complete ignorance of Web design may be the only problem.)

Offline Matamore!

  • Hero Member
  • *****
  • Posts: 4,118
    • View Profile
Re: Anyone know HTML? Does this BBC code make sense?
« Reply #1 on: November 05, 2014, 11:01:36 PM »
The magic, whatever it is, is presumably done by this spell:
Code: [Select]



but whereas I do know a tiny, tiny amount about HTML, I know absolutely nothing about Javascript (yet), so I\'m none the wiser.

Offline Matamore!

  • Hero Member
  • *****
  • Posts: 4,118
    • View Profile
Re: Anyone know HTML? Does this BBC code make sense?
« Reply #2 on: November 05, 2014, 11:20:59 PM »
Quote
If there is an element in the DOM that has an ID exactly equal to fragid, then the first such element in tree order is the indicated part of the document; stop the algorithm here.
If there is an a element in the DOM that has a name attribute whose value is exactly equal to fragid, then the first such element in tree order is the indicated part of the document; stop the algorithm here.


I don\'t know what \"DOM\" is (it might as well be \"DICK\", \"ANT\", or \"DEC\" as far as I\'m concerned!), but I see this in the HTML:
Code: [Select]


  •    [info about [i]The Book of Strange New Things[/i]]
       [the Javascript code, pasted above]
       

       



  • So, is it that the browser is finding this whole
  • element (with id=\"b04lhh4s\" ), properly treating that as the fragment, and executing the Javascript code, which produces the \"magic\" (perhaps with the aid of that final incantation about \"children\" )?

  • Offline Matamore!

    • Hero Member
    • *****
    • Posts: 4,118
      • View Profile
    Re: Anyone know HTML? Does this BBC code make sense?
    « Reply #3 on: November 05, 2014, 11:33:39 PM »
    No, that doesn\'t make sense, either.

    I still don\'t know why, when I click on this perfectly ordinary-looking URL in the context of an episode guide page:
    Code: [Select]

    http: //www.bbc.co.uk/programmes/b04lhh4s/episodes/guide

    I end up with my browser showing this in its address window:
    Code: [Select]

    http: //www.bbc.co.uk/programmes/b006qy2s/episodes/guide#b04lhh4s

    I suppose there must be some other JavaScript black magic going on.

    Oh well, time for bed.

    Stone me, what a life!

    Offline Matamore!

    • Hero Member
    • *****
    • Posts: 4,118
      • View Profile
    Re: Anyone know HTML? Does this BBC code make sense?
    « Reply #4 on: November 11, 2014, 06:41:25 PM »
    I\'m just starting to look at this again, after nearly a week, because there were several other things that had to be done before I could even start to try to code for this new development.

    (Yes, I know no-one\'s interested! But I\'m not hurting anybody, and it keeps me off the streets.)

    For a programme (e.g. 15 Minute Drama - I think the term the BBC themselves use may be \'brand\', rather than \'programme\'), or for what I\'m provisionally calling \'titled sequences\' of episodes of a programme (e.g. The Book of Strange New Things - the BBC\'s name for such an entity may be \'series\' or \'subseries\' - I\'m not sure, but I\'m not about to try to ask them!), all the necessary \'episode guide\' information seems to be contained in nicely condensed, untitled Web pages with URLs like the following (for the same examples I\'ve been using all along, The Book of Strange New Things and 15 Minute Drama):
    Code: [Select]

    http: //www.bbc.co.uk/programmes/b04lhh4s/episodes/guide.esi

    http: //www.bbc.co.uk/programmes/b006qy2s/episodes/guide.esi
    http: //www.bbc.co.uk/programmes/b006qy2s/episodes/guide.esi?page=2
    ...
    http: //www.bbc.co.uk/programmes/b006qy2s/episodes/guide.esi?page=11

    You can view the code using Ctrl-U in Firefox (although the usual Tools | Page Info display is uninformative).

    It contains none of the BBC\'s usual heavyweight HTML boilerplate code, which is a merciful relief.

    There is some technical info here, but I haven\'t even attempted to understand it (I only just ordered a bunch of books on XML last week, so that I can start studying the basics of Web design):

    Edge Side Includes - Wikipedia, the free encyclopedia
    Using ESI, Part 1: Simple Edge-Side Include | Fastly - The Next Gen CDN
    BBC - BBC Module - ESI (Edge Side Includes)

    Offline Janaru

    • Administrator
    • Hero Member
    • *****
    • Posts: 18,401
      • View Profile
    Re: Anyone know HTML? Does this BBC code make sense?
    « Reply #5 on: November 12, 2014, 03:23:59 PM »
    It\'s not that I\'m not interested...it\'s just that it flies over my head so fast it singes my hair!


    And we GOTTA keep ya\' off the streets, man...that\'s just a given. ;)
    Note to self:  Use your powers for good, not for evil.....

    Offline Matamore!

    • Hero Member
    • *****
    • Posts: 4,118
      • View Profile
    Re: Anyone know HTML? Does this BBC code make sense?
    « Reply #6 on: November 12, 2014, 03:29:09 PM »
    Yeah, I might get run over.

    Offline gbgian

    • Full Member
    • ***
    • Posts: 102
      • View Profile
    Re: Anyone know HTML? Does this BBC code make sense?
    « Reply #7 on: November 12, 2014, 06:56:57 PM »
    Matamore!
    You are the embodiment of Human curiosity!
    One would think that the new Star Wars film was about you The Force awakens, because this situation has really \"woken\" something within you!
    go for it man - this topic is so... so fascinating, it\'s.. it\'s like watching a foreign film in a language you don\'t understand where the subtitles are also in a different language! But... what your seeing is something great, even if you don\'t understand it -you know that your watching history being made!

    I will follow this topic to it\'s end even though it may:
    ...
    Quote from: Janaru

    it flies over my head so fast it singes my hair!
    [Corporal Nobbs had been disqualified from the human race for shoving. Sir Terry Pratchett]

    Offline Matamore!

    • Hero Member
    • *****
    • Posts: 4,118
      • View Profile
    Re: Anyone know HTML? Does this BBC code make sense?
    « Reply #8 on: November 12, 2014, 07:42:01 PM »
    I know - the BBC website is a fiendishly convoluted psychological experiment conducted by hyperintelligent pandimensional white mice! You must warn everybody before they ... aaaarggh! ...

    Offline Janaru

    • Administrator
    • Hero Member
    • *****
    • Posts: 18,401
      • View Profile
    Re: Anyone know HTML? Does this BBC code make sense?
    « Reply #9 on: November 13, 2014, 06:23:04 PM »
    :)


    I agree, gbgian. I can\'t wait to see what happens!
    Note to self:  Use your powers for good, not for evil.....