Is it possible to take a snippet of a web page as HTML?

Is there a Chrome Extension or Edge extension or other software which will let me select a region on a web page and then extract a snippet of that region as HTML rather than as an image? The reason I want to do this is to share a portion of a web page and keep hyperlinks active when I share the snippet.

Not really what you asked for but: If you use CMD + P to capture a webpage then create a PDF of one or more of the pages, the links will be active.

Thanks

There is also an extension which does that with a selected part of the screen rather than the whole screen

While that is very helpful the problem is that I often share such snippets with colleagues by text message - and if you share a PDF file by iMessage the links only become active if you explicitly open the file in a PDF reader; they open by default in Preview and that does not recognize the links.

1 Like

You can always use the right-click command “Inspect” in Chrome. (Also found under “View / Developer” menu item.) This will give you the full HTML as currently available in your browser with element-level granularity.

Just copying a block of HTML won’t secure any access to possible dependencies like scripts or CSS formatting, but the links should be retained if they are fully qualified URLs (guessing relative links may be an issue).

Depending on the site, this approach may work for you, even if it is a bit rough.

That’s an interesting idea and might have worked in the early days of HTML with mostly static sites, but I am not sure it is possible especially with a data-driven site with complex formatting.

As an example - suppose I want to take a snapshot of HTML to reproduce your post in this thread. I can find an element with the raw text but I cannot find a section of HTML to copy from there which reproduces the formatting/styling to any realistic degree. Can you?

SingleFile can do this for you with inlined styles. Select that portion of the page > right click > SingleFile > Save selection.

2 Likes

No, because usually styling is held in external stylesheets separate from the HTML the problem is only going to be compounded when you add javascript driven sites into the mix where a whole page can be rendered and held within the javascript itself.

As mentioned saving as a self contained single page file via a plugin which pulls the styles and javascript in is the only real "solution"other than of course just sending someone a link to the page itself.

1 Like