How do I link directly to a specific PART of a blog post or online article? (e.g. to a paragraph or heading)

42

Solution 1

In HTML, you can link to fragments by appending #FRAGMENT at the URL, where FRAGMENT is the value of an id attribute (on any element) or a name attribute (on an a or area element). The HTML author has to provide these attributes.

A manual way how to find these: Mark the whole content you want to link to, inspect the source code (usually rightclick and then something like "Show source"), and Ctrl+f for id= and name=.

XPointer is a specification that allows to link to any part of a XHTML document, even if the author didn’t provide any fragment identifiers. Currently you’d probably need a browser add-on (and so does the one you want to give the link to) to enable XPointer support.

For old versions of Firefox, there is FXPointer:

How many times have you told a friend or colleague "Go to http://example.com/some/doc and search for XXXX" ? I do it a lot actually. In fact, this becomes increasingly important as the mobile web accelerates and small screens with harder-to-use keyboards become more prevalent. I would like to start creating links in my documents and blog posts that point exactly to some paragraph on the page. I hope the FXPointer Firefox extension will help.

Solution 2

You can't (on this specific page). Linking to a particular subsection (such that a user's browser automatically scrolls to it) requires the use of HTML Anchors for each section, which that page does not have. More specifically, the heading would need to either contain or have nearby:

  • An A (anchor) tag
  • With an id or name property

If those criteria are met, then you can link to

http://example.com/webpage.html#anchorName

where anchorName is the value of the name or id property.

That Trello page just has a header though:

<h2>Card Aging</h2>

So it can't be linked to. If they had used instead:

<h2><a name="aging">Card Aging</a></h2>

then you could link to it like such:

http://blog.trello.com/introducing-power-ups-calendar-card-aging-and-more/#aging

Solution 3

In modern versions of Chrome, you can use this special anchor: #:~:text=ENCODED_TEXT_YOU_WANT_TO_LINK.

https://www.howtogeek.com/658842/how-to-use-google-chromes-new-deep-linking-feature/

Share:
42

Related videos on Youtube

nonoru
Author by

nonoru

Updated on September 18, 2022

Comments

  • nonoru
    nonoru over 1 year

    I have to ensure that I read in a text file(input) and transpose the matrix whereby the rows become columns.

    Sample input:

    2 4
    abcd/
    efgh 
    

    (whereby 2 indicates row and 4 indicates column and / indicates new line) and output should look like:

    ae/
    bf/
    cg/
    dh
    

    This is my code:

    import java.util.*;
    
    public class Transpose {
        private void run() {
            Scanner scan=new Scanner(System.in);
            int Row= scan.nextInt();
            int Col=scan.nextInt();
            char[][] arr=new char[Row][Col];
            for(int i=0;i<Row;i++){
                for(int j=0;j<Col;j++){
                    arr[i][j]=scan.next().charAt(0);
                }
            }
            for(int j=0;j<Col;j++){
                for(int i=0;i<Row;i++){
                    System.out.print(arr[i][j]);
                }
                System.out.println();
            }
        }
    
        public static void main(String[] args) {
            Transpose newTranspose = new Transpose();
            newTranspose.run();
        }
    }
    

    However, I am getting the error: programme crashed/producing non-zero exit code Is this a runtime error and how can I go about fixing this.

    • Michael Fehr
      Michael Fehr almost 4 years
      Welcome to Stackoverflow. Please edit your post and copy/paste your code instead of posting a picture with code, thanks.
  • fatuhoku
    fatuhoku almost 11 years
    As I suspected; I think a service that would address a particular smidgin of data on 'static' content with an XPath or something would actually be really useful. Seems like the best you can do is to highlight a section with the mouse and store that subtree in applications like Evernote; then you share it that way. I hope someone provides a fix for this situation...!
  • unor
    unor almost 11 years
    Note that the id attribute can be used on any element, not only a.
  • nonoru
    nonoru almost 4 years
    Thanks for your help! This code worked for me! Just for clarification I observe that u added scanned every line and then indexed it to get the characters which I missed out. Is that why my code may not work?