1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fragment identifier

Discussion in 'HTML, Graphics & Programming' started by bdu, 4 Jan 2019.

  1. bdu

    Associate

    Joined: 4 Jan 2019

    Posts: 3

  2. GravyMonster

    Capodecina

    Joined: 18 Oct 2002

    Posts: 14,263

    Location: The land of milk & beans

    There is no standard. Anything after the # in the URL is the fragment, as you've correctly stated. You can place literally anything here (so long as it's been URL encoded).

    It would appear that Wikipedia are using it to store a reference to the image to be displayed. Note that it's not the *actual* relative image path though, as that's "/wikipedia/commons/thumb/b/b4/IceAgeEarth.jpg/800px-IceAgeEarth.jpg"
     
  3. bdu

    Associate

    Joined: 4 Jan 2019

    Posts: 3

    Very thanks, Spunkey
    Yes, of course. But who does it process? Wikipedia (https://en.wikipedia.org/wiki/Fragment_identifier#Basics) writes:
    Here we have the strange link again: https://en.wikipedia.org/wiki/Ice_age#/media/File:IceAgeEarth.jpg. When we click at it the browser asks the server for https://en.wikipedia.org/wiki/Ice_age, gets it and then (the browser!) processes the fragment #/media/File:IceAgeEarth.jpg. But what can the browser do with it? I guess it doesn't know anything about file system architecture of Wikipedia. How does it work? I'm still confused.
     
  4. GravyMonster

    Capodecina

    Joined: 18 Oct 2002

    Posts: 14,263

    Location: The land of milk & beans

    The fragment will be read on the client (most likely in Javascript) and then it will execute whatever logic is needed for the given fragment value. This is all entirely proprietary. As such you can do literally anything you need.

    In the case of Wikipedia, they are detecting the fragment and showing a modal window with the relevant image. This is why you can see the normal Wiki entry underneath the image for a split second; it's loading the modal.

    Don't be fooled by the fact that the fragment looks like a file path. That's just a convention they are following. It could as well say 'EkkeEkkeEkkeEkkePtangZooBoing' and work just as well.
     
  5. bdu

    Associate

    Joined: 4 Jan 2019

    Posts: 3

    My God, I forgot that I enabled scripting for Wikipedia. Yes, you are right, it is processed by Javascript. When I switch it off, it doesn't work anymore. I was confused, because scrolling to a normal (?) fragment like in https://en.wikipedia.org/wiki/Ice_age#Major_ice_ages does work without Javascript.

    Very Thanks again. Any "resolved" button here?