Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future of Historical View #1

Open
vegetableman opened this issue Oct 21, 2020 · 5 comments
Open

Future of Historical View #1

vegetableman opened this issue Oct 21, 2020 · 5 comments

Comments

@vegetableman
Copy link
Owner

vegetableman commented Oct 21, 2020

Historical view displays a single snapshot of a webpage for each year that it's been archived for. It uses Puppeteer to capture screenshots which in turn runs on AWS Lambda as a serverless function. Screenshots are not free. For now, the service is running on AWS Free Tier and is free for 1M free requests per month until September this year. So, it likely will only last until then.

Also, It's just not a good user experience, as it's been throttled to around 5 seconds for each snapshot to reduce load on Archive servers. Hopefully Wayback could support something like this in the future.

@trumad
Copy link

trumad commented May 20, 2021

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?

@vegetableman
Copy link
Owner Author

vegetableman commented May 20, 2021

@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.

@trumad
Copy link

trumad commented May 21, 2021

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!

@vegetableman
Copy link
Owner Author

vegetableman commented May 21, 2021

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 😂.

@trumad
Copy link

trumad commented May 21, 2021

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants