View Issue Details

IDProjectCategoryView StatusLast Update
0000020DefKeyGeneralpublic2020-01-24 15:42
Reporterzeynel Assigned Tozeynel  
PrioritynormalSeverityfeatureReproducibilityN/A
Status assignedResolutionopen 
Summary0000020: Cookieless requests with JS fetch / CSS Sprites
Description

This can be used in whatmeanskey page, which requests many icons. Half working example is in top of shortcutarticle/index.

https://stackoverflow.com/questions/39149482/is-it-possible-to-prevent-cookies-to-be-sent-in-every-http-request

TagsNo tags attached.

Activities

zeynel

2019-08-08 13:30

administrator   ~0000011

Last edited: 2019-08-10 01:59

A big sprite with lot of icons seem like better solution to me. Using JS to load a lot of images doesn't sound so "natural" compared to a 20-30KB less data benefit of it.

40 256x256 icons are 140KB but a webp sprite with 40 40x40 icon at most 35KB. All icons will be displayed instantly with a sprite.

I takes less than 100ms to generate this sprite but it's better to cache result. When sprite is generated & saved, update shortcut's modified time. When serving this sprite, compare date in the sprite filename with last update time. If shortcut is newer, update the sprite.

  • Use uncompressed TIFF instead of BMP. BMPs aren't transparent...
  • Make sure same sprite is not regenerated all the time. Create a daily/weekly counter for it and display it in /dev
  • You'll need to create a field in shortcut table called 'iconSpriteFile'
  • Sprite image name will use webp extension. jpg version will be founded by replacing extension
  • Preload: Add sprite to "link" header.
  • Make sure you change filename when sprite file updated - you need to avoid ezoic cache.
  • When a program is added, update all of shortcut's modified time in shortcuts table.
  • When a program's shortcuts edited, update newly added (or if not possible, all) of shortcut's modified time in shortcuts table.
  • Sprite image will be transparent webp, but a opaque jpg version will be saved for Safari and iOS.
  • Would this need a fallback to non-sprite images? You can test webp support with modernizr.
  • Download all icons on website and generate sprites locally. Or else it'll be too much work for server, when Google Crawler scans pages.
  • If create sprite & css returns exception, fall back to normal <img> ?

There are about 4000 shortcuts. If average sprite size is 20KB, these files will only take 78MB of space. So it's not a waste of space definitely.

zeynel

2019-08-08 18:56

administrator   ~0000012

This can be guide to generating inline CSS in C#
https://www.w3schools.com/css/css_image_sprites.asp

zeynel

2019-08-11 00:37

administrator   ~0000013

On hold for now. HTTP2 makes sprites not so necessary. Anyway I almost finished this and may use it.

Issue History

Date Modified Username Field Change
2019-08-08 12:02 zeynel New Issue
2019-08-08 12:02 zeynel Status new => assigned
2019-08-08 12:02 zeynel Assigned To => zeynel
2019-08-08 12:13 zeynel Description Updated
2019-08-08 12:14 zeynel Sticky Issue No => Yes
2019-08-08 13:30 zeynel Note Added: 0000011
2019-08-08 14:22 zeynel Note Edited: 0000011
2019-08-08 14:32 zeynel Note Edited: 0000011
2019-08-08 14:34 zeynel Note Edited: 0000011
2019-08-08 14:35 zeynel Note Edited: 0000011
2019-08-08 14:36 zeynel Note Edited: 0000011
2019-08-08 15:10 zeynel Note Edited: 0000011
2019-08-08 15:15 zeynel Note Edited: 0000011
2019-08-08 18:56 zeynel Note Added: 0000012
2019-08-08 23:48 zeynel Note Edited: 0000011
2019-08-09 00:19 zeynel Note Edited: 0000011
2019-08-09 00:26 zeynel Note Edited: 0000011
2019-08-10 01:59 zeynel Note Edited: 0000011
2019-08-11 00:37 zeynel Note Added: 0000013
2019-08-24 17:20 zeynel Summary Cookieless requests with JS fetch => Cookieless requests with JS fetch / CSS Sprites
2020-01-24 15:42 zeynel Sticky Issue Yes => No