by Yukinu » Wed Jan 10, 2024 4:55 am
Amelia wrote: ↑Tue Jan 09, 2024 4:20 pm
One of the cool things I really like about the website is that Yukinu is actively trying to make it as compatible with obscure technologies as humanly possible. This site taught me about the existence of the <details> tag. Now I write my website page by page, by hand, and my 'once a frames user, always a frames user' philosophy knocks most of my site's sidebar menu off of browsers without <iframes> support, I would still love to learn more on how I could optimize my site further, what HTML tags and CSS attributes to use and what to avoid, and such.
Yes, I definitely need to write a comprehensive guide at some point documenting a lot of the tricks I use for backwards compatible site design. For example, here is my snippet for creating backwards compatible videos:
Code: Select all
<video style="max-width: 100%;" width="1920" height="1080" poster="video.png" controls="controls">
<source src="video.ogv" type="video/ogg" />
<source src="video.webm" type="video/webm" />
<source src="video.mp4" type="video/mp4" />
<object width="1920" height="1080" type="application/x-shockwave-flash" data="video.swf">
<param name="movie" value="video.swf" />
<param name="flashvars" value="controlbar=over&image=video.png&file=video.mp4" />
<a href="video.ogv">
<img style="max-width: 100%" src="video.png" />
</a>
</object>
</video>
The video is wrapped in a <video> tag with <source> tags in 4 different formats. Browsers that support the HTML5 <video> and <source> tags will go through the list and pick whichever video format it has codecs for. If a browser doesn't support HTML5 video but does have flash player, it will fallback to the <object> tag with the video encoded in SWF format. Finally, if the browser doesn't support video at all, it will fallback even further to an <a> tag with a picture of the video thumbnail and a download link to the video file (so even browsers like Netsurf without video, plugins, and scripts can still access the video). Looking backwards, that snippet will work on browsers that are 2 decades old, and as long as browser keep existing will probably work forwards for another 2 decades or more.
Some practical advice:
- I keep my browser viewport in 1024x768 resolution.
- This was one of the most common screen resolutions in the 2000s, and designing your site around this resolution will ensure that it's viewable properly on older hardware.
- Targeting this resolution doesn't compromise making your site mobile friendly either. Older browsers don't support media queries, but essentially the entire history of mobile browsers supports them, so you start with a backwards compatible desktop site, and scale it down to backwards and forwards compatible mobile friendly site.
- For even better backwards compatibility, target 800x600 viewport.
- I don't use any new CSS features unless they have a clear fallback. For example, the background gradient on the site uses linear-gradient(), but I fall back to a gradient background image if the browser (like Netsurf) doesn't support that CSS feature. Background images have been a standard CSS feature for decades.
- I don't use any new CSS layouts. You can actually get flexible pages without flexbox or flexgrid by using the older CSS float layout and HTML tables.
- I keep copies of old browsers around. In particular, I tend to test on:
- Palemoon (Goanna engine).
- Opera 12 (before the shift to chromium).
- IE8 (IE6 would be slightly better to test on, but I don't have a copy that works with WINE).
- Netsurf (independent browser and engine that is available on many platforms, doesn't have any JavaScript).
- When I write JavaScript code, I generally write in ES3/ES5.
- The JS engines are typically optimized for ES3/ES5, and a lot of ES6+ features are actually slower than similar ES3/ES5 ones (for example, document.querySelector('#foo') is massively slower than document.getElementById('foo'), and yet both do effectively the same thing).
- The best way to learn ES3/ES5 is to pick up an old JavaScript book from the 2000s. JavaScript was actually quite cozy at this time, given how small the language was back then.
- When in doubt, check https://caniuse.com to see how long an HTML, CSS, or JS feature has been supported.
There is a term for this particular philosophy of of web development,
Progressive Enhancement. In this philosophy, the developer starts the project by trying to add as many of their required features as possible using only the most basic and minimal of resources and tools, and then once all of the options have been exhausted, the dev then finally adds enhancements on top. The video snippet from above is an example. Going backwards, it starts with a link to a video, then adds a video for flash player, then older HTML5 codecs, and finally newer codecs. The basic <a> tag is enough to transport the video through the web, but the HTML5 video is an enhancement on top of it.
Amelia wrote: ↑Tue Jan 09, 2024 4:20 pm
This site taught me about the existence of the <details> tag.
<details> is a great way to add dropdown menus without the need for JavaScript. If you look at the CSS I'm using on the site, I hide the <details> tag by default using CSS (via
display: none since that CSS attribute is supported by very old browsers), and then use a
@media query to unhide it once the page gets smalle[/b]r (and hide the default navigation). Old browsers that don't support <details> will never actually see it, and thus it won't cause any issues on those browsers (browsers generally treat unsupported tags as <div>s, so if I did it the other way around the navigation on older browsers would be affected).
[quote=Amelia post_id=613 time=1704817252]
One of the cool things I really like about the website is that Yukinu is actively trying to make it as compatible with obscure technologies as humanly possible. This site taught me about the existence of the <details> tag. Now I write my website page by page, by hand, and my 'once a frames user, always a frames user' philosophy knocks most of my site's sidebar menu off of browsers without <iframes> support, I would still love to learn more on how I could optimize my site further, what HTML tags and CSS attributes to use and what to avoid, and such.
[/quote]
Yes, I definitely need to write a comprehensive guide at some point documenting a lot of the tricks I use for backwards compatible site design. For example, here is my snippet for creating backwards compatible videos:
[code]
<video style="max-width: 100%;" width="1920" height="1080" poster="video.png" controls="controls">
<source src="video.ogv" type="video/ogg" />
<source src="video.webm" type="video/webm" />
<source src="video.mp4" type="video/mp4" />
<object width="1920" height="1080" type="application/x-shockwave-flash" data="video.swf">
<param name="movie" value="video.swf" />
<param name="flashvars" value="controlbar=over&image=video.png&file=video.mp4" />
<a href="video.ogv">
<img style="max-width: 100%" src="video.png" />
</a>
</object>
</video>
[/code]
The video is wrapped in a <video> tag with <source> tags in 4 different formats. Browsers that support the HTML5 <video> and <source> tags will go through the list and pick whichever video format it has codecs for. If a browser doesn't support HTML5 video but does have flash player, it will fallback to the <object> tag with the video encoded in SWF format. Finally, if the browser doesn't support video at all, it will fallback even further to an <a> tag with a picture of the video thumbnail and a download link to the video file (so even browsers like Netsurf without video, plugins, and scripts can still access the video). Looking backwards, that snippet will work on browsers that are 2 decades old, and as long as browser keep existing will probably work forwards for another 2 decades or more.
Some practical advice:
[list]
[*] I keep my browser viewport in 1024x768 resolution.
[list]
[*] This was one of the most common screen resolutions in the 2000s, and designing your site around this resolution will ensure that it's viewable properly on older hardware.
[*] Targeting this resolution doesn't compromise making your site mobile friendly either. Older browsers don't support media queries, but essentially the entire history of mobile browsers supports them, so you start with a backwards compatible desktop site, and scale it down to backwards and forwards compatible mobile friendly site.
[*] For even better backwards compatibility, target 800x600 viewport.
[/list]
[*] I don't use any new CSS features unless they have a clear fallback. For example, the background gradient on the site uses [b]linear-gradient()[/b], but I fall back to a gradient background image if the browser (like Netsurf) doesn't support that CSS feature. Background images have been a standard CSS feature for decades.
[*] I don't use any new CSS layouts. You can actually get flexible pages without flexbox or flexgrid by using the older CSS float layout and HTML tables.
[*] I keep copies of old browsers around. In particular, I tend to test on:
[list]
[*] Palemoon (Goanna engine).
[*] Opera 12 (before the shift to chromium).
[*] IE8 (IE6 would be slightly better to test on, but I don't have a copy that works with WINE).
[*] Netsurf (independent browser and engine that is available on many platforms, doesn't have any JavaScript).
[/list]
[*] When I write JavaScript code, I generally write in ES3/ES5.
[list]
[*] The JS engines are typically optimized for ES3/ES5, and a lot of ES6+ features are actually slower than similar ES3/ES5 ones (for example, [b]document.querySelector('#foo')[/b] is massively slower than [b]document.getElementById('foo')[/b], and yet both do effectively the same thing).
[*] The best way to learn ES3/ES5 is to pick up an old JavaScript book from the 2000s. JavaScript was actually quite cozy at this time, given how small the language was back then.
[/list]
[*] When in doubt, check https://caniuse.com to see how long an HTML, CSS, or JS feature has been supported.
[/list]
There is a term for this particular philosophy of of web development, [url=https://en.wikipedia.org/wiki/Progressive_enhancement?useskin=vector]Progressive Enhancement[/url]. In this philosophy, the developer starts the project by trying to add as many of their required features as possible using only the most basic and minimal of resources and tools, and then once all of the options have been exhausted, the dev then finally adds enhancements on top. The video snippet from above is an example. Going backwards, it starts with a link to a video, then adds a video for flash player, then older HTML5 codecs, and finally newer codecs. The basic <a> tag is enough to transport the video through the web, but the HTML5 video is an enhancement on top of it.
[quote=Amelia post_id=613 time=1704817252]
This site taught me about the existence of the <details> tag.
[/quote]
<details> is a great way to add dropdown menus without the need for JavaScript. If you look at the CSS I'm using on the site, I hide the <details> tag by default using CSS (via [b]display: none[/b] since that CSS attribute is supported by very old browsers), and then use a [b]@media query[/b] to unhide it once the page gets smalle[/b]r (and hide the default navigation). Old browsers that don't support <details> will never actually see it, and thus it won't cause any issues on those browsers (browsers generally treat unsupported tags as <div>s, so if I did it the other way around the navigation on older browsers would be affected).