htmlpreview / htmlpreview.github.com

HTML Preview for GitHub Repositories

Home Page:htmlpreview.github.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use iframe to support more complex sites

fonsp opened this issue · comments

Hi!

I made a version of this website that uses an iframe at full size to render the HTML content, which removes the needs for tricks like this one, and allows more complex pages to load correctly.

It uses iframeresizer to resize the iframe to match the content size. We fetch the HTML content from the raw URL like is done today, and then generate an object URL from the HTML content to use as the iframe source.

Try it out here:

https://htmlview.glitch.me/

(Source code is available on the top right of the page)


As an example, this HTML file does not work on the current site, likely because of script loading issues, but it does work with the iframe strategy:

https://github.com/mossr/PlutoNotebooks/blob/master/html/em_algorithm.html

I also added direct support for gist urls like https://gist.github.com/fonsp/a06a1359b612d22f7dbdb6256da1cf2d

Would you be interested in a PR? It would replace most of the existing codebase, but it seems like a more stable solution, and I suspect that it solves some of the currently open issues.

-fons

Cool approach. Can it be made to handle links so that the entire site is navigable? I'm interested in looking at profiling results rendered in html such as this, where if prepended with the htmlpreview url, doesn't load the flamegraph. If I inline the flamegraph, then it loads, but then links don't follow through correctly. Your approach has similar problems. Doesn't load the flamegraph, or it does, but either way the links on the page don't work.

I figure the most direct way to fix my problem is to include object fields in the processing for this tool.