Giter VIP home page Giter VIP logo

Comments (5)

trumad avatar trumad commented on August 20, 2024 1

Yeah, it sounds like html2canvas would be too janky, and opening & closing new tabs would be even worse. You've clearly given this a lot of thought.

Another option: https://blog.stackblitz.com/posts/introducing-webcontainers/. Run node on the browser and invoke puppeteer with in the browser to take a screenshot 🤯. That would be fun 😂.

That's the dumbest thing I ever heard. You should do it!

from vandal.

trumad avatar trumad commented on August 20, 2024

You could potentially fetch the html source of each year's page, then pop it into a sandboxed iframe:

var base64Source = btoa(unescape(encodeURIComponent(sourceHtml,currentHref,contentType)));
var iframeHtml = <iframe src="data:+contentType+;base64,+base64Source+" sandbox width="100%" height="300px"></iframe>;

But you've probably already tried something like this and it didn't work?

from vandal.

vegetableman avatar vegetableman commented on August 20, 2024

@trumad Tried it 😄. Too many iframes result in larger memory footprint messing up the tab and not to forget, scroll jank. Also, It's a bit like watching living, breathing creatures clamoring to get out of those mini cages.

from vandal.

trumad avatar trumad commented on August 20, 2024

lol, I've never thought of it that way. Those poor creatues... Could you make an iframe and then immediately screenshot it in the user's browser, then replace the iframe with a screenshot? I'm not sure how possible that is. I know it's easy to use canvas to get a screenshot, but I don't know about a whole iframe. Just spitballing, hope you don't mind!

from vandal.

vegetableman avatar vegetableman commented on August 20, 2024

Just spitballing, hope you don't mind!

Of course not.

Could you make an iframe and then immediately screenshot it in the user's browser, then replace the iframe with a screenshot?

It would be too many dom construction and destruction for a simple use-case, will probably mess up the framerate, making it unusable for the user. Also, for screenshots, html2canvas would have to be injected in to those frames somehow but if I recall correctly, it gives out inconsistent screenshots. Some styles are never captured. so, html2canvas is out.

Another option: https://developer.chrome.com/docs/extensions/reference/tabs/#method-captureVisibleTab
But that would require a tab with the archive url to be already open for the screenshot to work. So, it could become a case of opening and closing tabs for each archive url for taking a screenshot. again, not a good (more like silly) user experience.

Another option: https://blog.stackblitz.com/posts/introducing-webcontainers/. Run node on the browser and invoke puppeteer with in the browser to take a screenshot 🤯. That would be fun 😂.

from vandal.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.