standardebooks / web

The source code for the Standard Ebooks website.
https://standardebooks.org
Creative Commons Zero v1.0 Universal
235 stars 64 forks source link

Primitive Browser Support #126

Closed npars closed 1 year ago

npars commented 3 years ago

The Standard Ebooks website doesn't render correctly in some E-Reader browsers. For instance the Kobo Libra H20: PXL_20210508_171029248

Since the Kobo can download ebooks directly through the browser it would be great if the site was easier to navigate. Would it be possible to create a static "lite" version of the site, similar to the mobile websites that used to be common?

acabal commented 3 years ago

Maybe a good long term goal if someone is interested in working on it. We could serve a different stylesheet to browsers matching the Kobo user agent. But, debugging this would be extremely tedious.

robinwhittleton commented 2 years ago

I spent a while seeing if I could match the Kobo browser with specific media queries, but it looks like it just thinks it’s a normal browser on a normal machine. It doesn’t respond to @media (monochrome) or @media (max-color: 4) in any different way that my laptop. Unfortunate.

npars commented 2 years ago

I spent a while seeing if I could match the Kobo browser with specific media queries, but it looks like it just thinks it’s a normal browser on a normal machine. It doesn’t respond to @media (monochrome) or @media (max-color: 4) in any different way that my laptop. Unfortunate.

Could we key off of the user agent? My Kobo returns:

Mozilla/5.0 (Linux; U; Android 2.0; en-us;) AppleWebKit/538.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/538.1 (Kobo Touch 0384/4.30.18838)
acabal commented 2 years ago

User agent is an option. Check it in php and output a different stylesheet

On January 13, 2022 3:52:19 PM EST, "Neil P." @.***> wrote:

I spent a while seeing if I could match the Kobo browser with specific media queries, but it looks like it just thinks it’s a normal browser on a normal machine. It doesn’t respond to @. (monochrome)` or @. (max-color: 4)` in any different way that my laptop. Unfortunate.

Could we key off of the user agent? My Kobo returns: >


Mozilla/5.0 (Linux; U; Android 2.0; en-us;) AppleWebKit/538.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/538.1 (Kobo Touch 0384/4.30.18838)

-- > Reply to this email directly or view it on GitHub:

https://github.com/standardebooks/web/issues/126#issuecomment-1012506101

You are receiving this because you commented.

Message ID: @.***>

robinwhittleton commented 2 years ago

How stripped back do we want the ereader experience to be? My default inclination is pretty stripped back, but keeping the logo and fonts as part of our branding.

I’m currently building a completely separate ereader.css file that doesn’t include anything else. Once I’ve got something good working I’ll work out what’s shared and maybe make a base.css that both can include.

acabal commented 2 years ago

Yeah I'm not certain. As much as we can get away with, I suppose. If we're targeting eink then the big factor that will influence most of it is going to be what the browser supports, then color, and then the poor tap responsiveness of eink. I assume Kobo is just using Webkit. I don't know what Kindle uses but I'm sure it's awful.

robinwhittleton commented 2 years ago

OK, sounds good. I’ll post up a couple of photos when I’ve got something looking OK and we can see what people think. I’ll also update at least the Kobo download instructions if this can be made to work OK.

robinwhittleton commented 2 years ago

I spent a while hacking down the current core.css but I keep on running into horrible bugs that are super slow and boring to fix. So it’s time for plan B: start a completely new ereader.css that attempts to keep the current SE flavour, but does so with an absolute minimum of code. I’m only going to bother styling the homepage, books listing, and book pages.

alystair commented 2 years ago

Is this the rationale as to why the current site uses XHTML html headers and not something newer like HTML5?

acabal commented 2 years ago

No, the site uses XHTML headers because it's serving XHTML5. It's a whimsical nod to epub's roots. See https://alexcabal.com/posts/standard-ebooks-and-classic-web-tech

carderne commented 2 years ago

@robinwhittleton Have you made progress on this? Would be keen to help and make sure it works on Kindle as well. If you've done the user-agent bit I could have a hack at the CSS.

robinwhittleton commented 2 years ago

Yep, never got anywhere with plan B (building a new stylesheet up from scratch). You’re welcome to hack on it; there’s a commit which loads a stylesheet for Kindle and Kobo at https://github.com/robinwhittleton/web/commit/9876bdfb9be142b40bf60cc2cb032b1a6611068e that you can pull in to your fork if you want.

carderne commented 2 years ago

Thanks! Will give this a go soon (probably in at least two weeks, in case anyone else has suddenly become interested).

colagrosso commented 1 year ago

Hey, I've got a version of the CSS I'm happy with, so I've opened a pull request. I started from Robin's initial commit at robinwhittleton@9876bdf and then added the actual CSS.

One hacky thing I had to do was I removed multiple selection in the <select> element on the ebooks page. That's what's causing the major problems in the photo at the top of this issue. Neither Kobo or Kindle support it, with different failure modes. After that, the ebooks form was usable, and the rest was just styling to make it even better.

I tested the ereader CSS on these three devices:

PXL_20230319_214006263

acabal commented 1 year ago

Great work, thanks!