Skip to main content
KAnki is designed for jailbroken Kindle devices with very limited browser capabilities. Understanding these constraints is essential for customizing the app or creating compatible decks.

Kindle browser constraints

Kindle devices run an older WebKit-based browser with severely limited features compared to modern browsers.

JavaScript version

KAnki must use ES5 JavaScript only. No modern JavaScript features are supported.

Not available

  • Arrow functions: () => {}
  • Template literals: `Hello ${name}`
  • Destructuring: const {x, y} = obj
  • Spread operator: ...array
  • let and const declarations
  • Classes: class MyClass {}
  • Promises and async/await
  • Array methods like .find(), .includes(), .from()
  • Map, Set, Symbol, WeakMap

Must use instead

  • var for all variable declarations
  • function keyword for functions
  • String concatenation: 'Hello ' + name
  • Array.prototype.indexOf() instead of .includes()
  • Callback-based patterns instead of promises
  • XMLHttpRequest instead of fetch API

ES5 patterns in KAnki source

Here are examples from the actual codebase:

Polyfills included

KAnki includes polyfill.min.js to provide some modern JavaScript features as ES5-compatible implementations. However, the core codebase avoids relying on these when possible.

CSS limitations

The Kindle browser supports only basic CSS2 with minimal CSS3 features.

Not available

Modern layout systems don’t work on Kindle browsers.
  • No Flexbox: display: flex is not supported
  • No CSS Grid: display: grid is not supported
  • No CSS variables: var(--color-primary) doesn’t work
  • Limited transforms: Most transform properties fail
  • No animations: @keyframes and animation are unreliable
  • No media queries: @media has very limited support
  • No pseudo-elements: :before and :after work inconsistently

What works

Layout strategy

From the KAnki source, the app uses:
  1. Table-based layouts for complex arrangements:
  1. Fixed heights to prevent layout shifts on e-ink displays:
  1. Absolute positioning for overlays:

Font loading

Custom fonts must use @font-face with TTF format:
KAnki waits 1000ms after page load to ensure fonts are loaded before displaying cards. This prevents rendering issues with non-Latin scripts.

E-ink display optimization

E-ink screens refresh slowly and can show ghosting. KAnki implements several techniques to minimize visual issues:

Fixed element heights

Visibility instead of display

This prevents the screen from reflowing when elements appear/disappear.

Grayscale enforcement

Forces grayscale rendering since Kindle e-ink displays don’t show color.

Screen size variations

Different Kindle models have vastly different resolutions:
  • Basic Kindle: 600×800 pixels
  • Paperwhite: 1072×1448 pixels (higher DPI)
  • Oasis: 1264×1680 pixels
  • Scribe: 1860×2480 pixels

Responsive scaling

KAnki detects screen size and applies device-specific scaling:

Size-specific CSS classes

The app adds classes to enable device-specific styling:

Storage limitations

localStorage only

Kindle browsers don’t support IndexedDB, Web SQL, or other modern storage APIs.
KAnki uses localStorage exclusively:

Storage location

Data is stored at:
localStorage has a size limit of approximately 5-10MB on Kindle devices. For large decks (1000+ cards with extensive history), this can become a constraint.

Performance considerations

Debouncing viewport changes

Preventing accidental inputs

E-ink displays refresh slowly, so rapid interactions can cause problems.

DOM updates

Reuse existing elements instead of recreating:

Development workflow

When customizing KAnki:
  1. Test on actual hardware: Kindle’s browser behavior differs significantly from desktop browsers
  2. Use ES5 syntax exclusively: Run code through an ES5 transpiler if needed
  3. Avoid modern CSS: Stick to table layouts and absolute positioning
  4. Minimize DOM manipulation: Batch updates and reuse elements
  5. Test all Kindle models: Screen sizes vary dramatically
While you could use Babel to transpile modern JavaScript to ES5, the KAnki source code is deliberately written in ES5 to avoid build steps and keep development simple. If you add transpilation, test thoroughly on actual Kindle hardware as some polyfills may not work correctly.
Progressive enhancement would add complexity without benefit. Since the target platform (Kindle) is well-defined and unchanging, optimizing specifically for Kindle’s capabilities produces the most reliable results.