A place to cache linked articles (think custom and personal wayback machine)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <!doctype html><!-- This is a valid HTML5 document. -->
  2. <!-- Screen readers, SEO, extensions and so on. -->
  3. <html lang="fr">
  4. <!-- Has to be within the first 1024 bytes, hence before the `title` element
  5. See: https://www.w3.org/TR/2012/CR-html5-20121217/document-metadata.html#charset -->
  6. <meta charset="utf-8">
  7. <!-- Why no `X-UA-Compatible` meta: https://stackoverflow.com/a/6771584 -->
  8. <!-- The viewport meta is quite crowded and we are responsible for that.
  9. See: https://codepen.io/tigt/post/meta-viewport-for-2015 -->
  10. <meta name="viewport" content="width=device-width,initial-scale=1">
  11. <!-- Required to make a valid HTML5 document. -->
  12. <title>The #ViewSource Affordance (archive) — David Larlet</title>
  13. <meta name="description" content="Publication mise en cache pour en conserver une trace.">
  14. <!-- That good ol' feed, subscribe :). -->
  15. <link rel="alternate" type="application/atom+xml" title="Feed" href="/david/log/">
  16. <!-- Generated from https://realfavicongenerator.net/ such a mess. -->
  17. <link rel="apple-touch-icon" sizes="180x180" href="/static/david/icons2/apple-touch-icon.png">
  18. <link rel="icon" type="image/png" sizes="32x32" href="/static/david/icons2/favicon-32x32.png">
  19. <link rel="icon" type="image/png" sizes="16x16" href="/static/david/icons2/favicon-16x16.png">
  20. <link rel="manifest" href="/static/david/icons2/site.webmanifest">
  21. <link rel="mask-icon" href="/static/david/icons2/safari-pinned-tab.svg" color="#07486c">
  22. <link rel="shortcut icon" href="/static/david/icons2/favicon.ico">
  23. <meta name="msapplication-TileColor" content="#f7f7f7">
  24. <meta name="msapplication-config" content="/static/david/icons2/browserconfig.xml">
  25. <meta name="theme-color" content="#f7f7f7" media="(prefers-color-scheme: light)">
  26. <meta name="theme-color" content="#272727" media="(prefers-color-scheme: dark)">
  27. <!-- Documented, feel free to shoot an email. -->
  28. <link rel="stylesheet" href="/static/david/css/style_2021-01-20.css">
  29. <!-- See https://www.zachleat.com/web/comprehensive-webfonts/ for the trade-off. -->
  30. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  31. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  32. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  33. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  34. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  35. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  36. <script>
  37. function toggleTheme(themeName) {
  38. document.documentElement.classList.toggle(
  39. 'forced-dark',
  40. themeName === 'dark'
  41. )
  42. document.documentElement.classList.toggle(
  43. 'forced-light',
  44. themeName === 'light'
  45. )
  46. }
  47. const selectedTheme = localStorage.getItem('theme')
  48. if (selectedTheme !== 'undefined') {
  49. toggleTheme(selectedTheme)
  50. }
  51. </script>
  52. <meta name="robots" content="noindex, nofollow">
  53. <meta content="origin-when-cross-origin" name="referrer">
  54. <!-- Canonical URL for SEO purposes -->
  55. <link rel="canonical" href="https://htmx.org/essays/right-click-view-source/">
  56. <body class="remarkdown h1-underline h2-underline h3-underline em-underscore hr-center ul-star pre-tick" data-instant-intensity="viewport-all">
  57. <article>
  58. <header>
  59. <h1>The #ViewSource Affordance</h1>
  60. </header>
  61. <nav>
  62. <p class="center">
  63. <a href="/david/" title="Aller à l’accueil"><svg class="icon icon-home">
  64. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-home"></use>
  65. </svg> Accueil</a> •
  66. <a href="https://htmx.org/essays/right-click-view-source/" title="Lien vers le contenu original">Source originale</a>
  67. </p>
  68. </nav>
  69. <hr>
  70. <blockquote>
  71. <p>Not for nothing, Hypercard presaged the web’s critical “#ViewSource” affordance, which allowed people to copy,
  72. modify, customize and improve on the things that they found delightful or useful. This affordance was later adapted
  73. by other human-centered projects like #Scratch, and is a powerful tonic against #enshittification.</p>
  74. <p>--<a rel="noopener" target="_blank" href="https://twitter.com/doctorow/status/1701934612686196872">Cory Doctorow @pluralistic@mamot.fr</a></p>
  75. </blockquote>
  76. <h2 id="open-culture-the-web"><a class="zola-anchor" href="#open-culture-the-web" aria-label="Anchor link for: open-culture-the-web">#</a>Open Culture &amp; The Web</h2>
  77. <p>When people talk about open source software, that conversation is often dominated by
  78. <a rel="noopener" target="_blank" href="https://www.gnu.org/philosophy/free-sw.html">the Free Software Foundation’s notion of free software</a>:</p>
  79. <blockquote>
  80. <p>“Free software” means software that respects users’ freedom and community. Roughly, it means that the users have the
  81. freedom to run, copy, distribute, study, change and improve the software.“</p>
  82. </blockquote>
  83. <p>This definition of free software has been a useful one and, through advocating for it, the FSF has gifted the world a
  84. lot of wonderful open source software.</p>
  85. <p>Web applications, however, have always been an uncomfortable fit for this definition of free. This is mainly
  86. for technical reasons: web applications involve a web browser interacting with a web server that is, typically, running
  87. on a remote system.</p>
  88. <p>At a fundamental level, the REST-ful architecture of the web was built around <em>hypermedia representations</em> of remote
  89. resources: browsers deal only with hypermedia representations provided by the server and, thus, have no visibility into
  90. the actual source of the code executing on the server side.</p>
  91. <p>Now, the web has certainly <em>leveraged</em> free and open source software in its growth: browsers are typically (at least mostly)
  92. open source, server software is often open source, and so on. And there are, of course, open source web applications
  93. that users may run for things like forums and so forth.</p>
  94. <p>However, from the standpoint of typical web application users, web applications are not free in the FSF sense of that
  95. term: the users are unable to see and modify the source of the server code that is being executed as they interact with
  96. the application via the browser.</p>
  97. <h3 id="right-click-view-source-as-culture"><a class="zola-anchor" href="#right-click-view-source-as-culture" aria-label="Anchor link for: right-click-view-source-as-culture">#</a>Right-Click-View-Source As Culture</h3>
  98. <p>Despite the fact that the web has a somewhat uncomfortable relationship with the notion of free software, the early web
  99. none-the-less had a radically open <em>developer culture</em>. </p>
  100. <p>In fact, in some important and practical ways, the early web had a <em>more</em> open developer culture than what was achieved
  101. by the free software movement.</p>
  102. <p>The <a rel="noopener" target="_blank" href="https://en.wikipedia.org/wiki/View-source_URI_scheme">#ViewSource</a> affordance available in browsers allowed people
  103. to understand and “own”, at least in an informal way, the web in a way that even most FSF-conforming applications could
  104. not: you had direct access to the “source”, or at least <em>part</em> of the source, of the application available from
  105. <em>within</em> the application itself.</p>
  106. <p>You could copy-and-paste (or save) the “source” (HTML, JavaScript &amp; CSS) and start modifying it, without a complicated
  107. build tool chain or, indeed, without any tool chain at all.</p>
  108. <p>This radical openness of the web allowed many people, often not formally trained computer programmers, to learn how to
  109. create web pages and applications in an ad hoc and informal way.</p>
  110. <p>In strict free software terms, this was, of course, a compromise: as a user of a web application, you had no visibility
  111. into how a server was constructing a given hypermedia response.</p>
  112. <p>But you could see <em>what</em> the server was responding with: you could download and tweak it, poke and prod at it. You could,
  113. if you were an advanced user, use browser tools to modify the application in place.</p>
  114. <p>And, most importantly, you could <em>learn from it</em>, even if you couldn’t see how the HTML was being produced.</p>
  115. <p>This radical openness of the client and network protocol, and the culture it produced, was a big part of the success
  116. of the early web.</p>
  117. <h2 id="digital-enclosure-vs-technical-enclosure"><a class="zola-anchor" href="#digital-enclosure-vs-technical-enclosure" aria-label="Anchor link for: digital-enclosure-vs-technical-enclosure">#</a>Digital Enclosure vs. Technical Enclosure</h2>
  118. <p>The <a rel="noopener" target="_blank" href="https://en.wikipedia.org/wiki/Enclosure">Enclosure Movement</a> was a period in English history when what were
  119. previously <a rel="noopener" target="_blank" href="https://en.wikipedia.org/wiki/Commons">commons</a> were privatized.</p>
  120. <p>This was a traumatic event in English history, as evidenced by this poem by an 18th century anon:</p>
  121. <blockquote>
  122. <p>The law locks up the man or woman</p>
  123. <p>Who steals the goose from off the common,</p>
  124. <p>But lets the greater felon loose</p>
  125. <p>Who steals the common from the goose.</p>
  126. <p>–18th century anon</p>
  127. </blockquote>
  128. <p>In the last decade, the web has gone through a period of “Digital Enclosure”, where <a rel="noopener" target="_blank" href="https://en.wikipedia.org/wiki/Closed_platform">“Walled Gardens”</a>,
  129. such as Facebook &amp; Twitter, have replaced the earlier, more open and more chaotic blogs and internet forums.</p>
  130. <h3 id="technical-enclosure"><a class="zola-anchor" href="#technical-enclosure" aria-label="Anchor link for: technical-enclosure">#</a>Technical Enclosure</h3>
  131. <p>Many (most?) web developers have decried this trend.</p>
  132. <p>However, despite recognizing the danger of an increasingly closed internet, many web developers don’t consider their own
  133. technical decisions and how those decisions can also contribute to the disappearance of web’s <em>culture</em> of openness.</p>
  134. <p>Inadvertently (for the most part) technical trends and decisions in web development in the last two decades have lead
  135. to what we term a “Technical Enclosure” of the web, a processes whereby technical decisions chip away at the #ViewSource
  136. affordance that Cory Doctrow discusses in the opening quote of this article, an affordance that existed as a commons
  137. for early web developers.</p>
  138. <p>To see a stark example of the decline of the <a rel="noopener" target="_blank" href="https://en.wikipedia.org/wiki/View-source_URI_scheme">#ViewSource</a> affordance
  139. in web development and Technical Enclosure in action, we can look at what is perhaps the most popular web page on the
  140. internet, <a rel="noopener" target="_blank" href="https://google.com">The Google Homepage</a>.</p>
  141. <p>Here is the nearly complete source of that page from the year 2000, taken from
  142. <a rel="noopener" target="_blank" href="http://web.archive.org/web/20000229040250/http://www.google.com/">the wayback machine</a>:</p>
  143. <h3 id="google-in-2000"><a class="zola-anchor" href="#google-in-2000" aria-label="Anchor link for: google-in-2000">#</a>Google in 2000</h3>
  144. <p><img src="https://htmx.org/img/google-2000.png" alt="Google Source Code in 2000"></p>
  145. <p>In contrast, here is a random snapshot of roughly 1/100th of the current source code for the website:</p>
  146. <h3 id="google-in-2023"><a class="zola-anchor" href="#google-in-2023" aria-label="Anchor link for: google-in-2023">#</a>Google in 2023</h3>
  147. <p><img src="https://htmx.org/img/google-2023.png" alt="Google Source Code in 2023"></p>
  148. <p>These two screenshots dramatically demonstrate the decline in the effectiveness of the <a rel="noopener" target="_blank" href="https://en.wikipedia.org/wiki/View-source_URI_scheme">#ViewSource</a> affordance over time:
  149. yes, you can still right-click the page and view its underlying source, but making sense of the latter code would be
  150. challenging for even the most seasoned web developer.</p>
  151. <p>A new web developer would have almost no chance of deriving any value from doing so.</p>
  152. <p>Now, this is not to criticize the google engineer’s technical decisions that lead to this situation <em>as technical
  153. decisions</em>: obviously, despite similar appearances, the google homepage of 2023 is far more sophisticated than the one
  154. available in 2000.</p>
  155. <p>The 2023 google homepage is going to be a lot more complicated than the 2000 page and, given the zeitgeist, it is going to
  156. involve a lot of JavaScript.</p>
  157. <p>However, this is to point out that something deeply important about the early web has been lost, almost certainly
  158. unintentionally, along the way: the ability to view the source of the page, make sense of what it is doing and, most
  159. importantly, to learn from it.</p>
  160. <h2 id="right-click-view-source-extremism"><a class="zola-anchor" href="#right-click-view-source-extremism" aria-label="Anchor link for: right-click-view-source-extremism">#</a>Right-Click-View-Source Extremism</h2>
  161. <p>Both <a href="https://htmx.org/">htmx</a> and <a rel="noopener" target="_blank" href="https://hyperscript.org">hyperscript</a> adhere to the <a href="https://htmx.org/essays/locality-of-behaviour/">Locality of Behavior</a>
  162. design principle.</p>
  163. <p>This principle states that:</p>
  164. <blockquote>
  165. <p>The behaviour of a unit of code should be as obvious as possible by looking only at that unit of code</p>
  166. </blockquote>
  167. <p>The main technical advantage of Locality of Behavior is ease of maintenance, as outlined in the essay above.</p>
  168. <p>However, there is an important cultural benefit to the Locality of Behavior of htmx and hyperscript as well: <strong>it restores
  169. the power of the <a rel="noopener" target="_blank" href="https://en.wikipedia.org/wiki/View-source_URI_scheme">#ViewSource</a> affordance on the web</strong>.</p>
  170. <p>Consider <a rel="noopener" target="_blank" href="https://arhamjain.com/hyperwordle/">Hyperwordle</a>, a hyperscript-based clone of the popular
  171. <a rel="noopener" target="_blank" href="https://www.nytimes.com/games/wordle/index.html">Wordle</a> game, now owned by the New York Times.</p>
  172. <p>You can visit Hyperwordle, right click and view the source of it, and you will be presented with some HTML and hyperscript,
  173. all of which is, with a bit of effort, understandable.</p>
  174. <p>The <a rel="noopener" target="_blank" href="https://en.wikipedia.org/wiki/View-source_URI_scheme">#ViewSource</a> affordance is effective in this case.</p>
  175. <p>Contrast this with the view-source experience of the Wordle implementation at the New York Times.</p>
  176. <p>Now, this is of course a bit unfair: the NYTimes version has a lot more functionality and is heavily optimized. Hyperwordle
  177. is a proof of concept and not being hammered by millions of users every day.</p>
  178. <p>Despite that qualification, Hyperwordle demonstrates a potential future for the web, a future where a culture of openness,
  179. of <a rel="noopener" target="_blank" href="https://en.wikipedia.org/wiki/View-source_URI_scheme">#ViewSource</a> politeness, is once again a touchstone of the
  180. culture of the web.</p>
  181. <p>Engineers who care about the open culture of the web should recognize that the threats to that culture come not only from
  182. Digital Enclosure by large, private companies of the most important pieces of the web.</p>
  183. <p>They should also recognize the risks of Technical Enclosure, and the <em>non-technical</em> value of the
  184. <a rel="noopener" target="_blank" href="https://en.wikipedia.org/wiki/View-source_URI_scheme">#ViewSource</a> affordance in perpetuating the open culture of
  185. web development. They should start thinking about making this affordance a priority in their technical decisions. As
  186. with all priorities, this may involve trading off against other technical and even functional priorities during
  187. application development.</p>
  188. <p>But if we don’t stand up for <a rel="noopener" target="_blank" href="https://en.wikipedia.org/wiki/View-source_URI_scheme">#ViewSource</a>, no one else will.</p>
  189. <p><img src="https://htmx.org/img/memes/viewsource.png" alt="Right Click View Source Guy"></p>
  190. </article>
  191. <hr>
  192. <footer>
  193. <p>
  194. <a href="/david/" title="Aller à l’accueil"><svg class="icon icon-home">
  195. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-home"></use>
  196. </svg> Accueil</a> •
  197. <a href="/david/log/" title="Accès au flux RSS"><svg class="icon icon-rss2">
  198. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-rss2"></use>
  199. </svg> Suivre</a> •
  200. <a href="http://larlet.com" title="Go to my English profile" data-instant><svg class="icon icon-user-tie">
  201. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-user-tie"></use>
  202. </svg> Pro</a> •
  203. <a href="mailto:david%40larlet.fr" title="Envoyer un courriel"><svg class="icon icon-mail">
  204. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-mail"></use>
  205. </svg> Email</a> •
  206. <abbr class="nowrap" title="Hébergeur : Alwaysdata, 62 rue Tiquetonne 75002 Paris, +33184162340"><svg class="icon icon-hammer2">
  207. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-hammer2"></use>
  208. </svg> Légal</abbr>
  209. </p>
  210. <template id="theme-selector">
  211. <form>
  212. <fieldset>
  213. <legend><svg class="icon icon-brightness-contrast">
  214. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-brightness-contrast"></use>
  215. </svg> Thème</legend>
  216. <label>
  217. <input type="radio" value="auto" name="chosen-color-scheme" checked> Auto
  218. </label>
  219. <label>
  220. <input type="radio" value="dark" name="chosen-color-scheme"> Foncé
  221. </label>
  222. <label>
  223. <input type="radio" value="light" name="chosen-color-scheme"> Clair
  224. </label>
  225. </fieldset>
  226. </form>
  227. </template>
  228. </footer>
  229. <script src="/static/david/js/instantpage-5.1.0.min.js" type="module"></script>
  230. <script>
  231. function loadThemeForm(templateName) {
  232. const themeSelectorTemplate = document.querySelector(templateName)
  233. const form = themeSelectorTemplate.content.firstElementChild
  234. themeSelectorTemplate.replaceWith(form)
  235. form.addEventListener('change', (e) => {
  236. const chosenColorScheme = e.target.value
  237. localStorage.setItem('theme', chosenColorScheme)
  238. toggleTheme(chosenColorScheme)
  239. })
  240. const selectedTheme = localStorage.getItem('theme')
  241. if (selectedTheme && selectedTheme !== 'undefined') {
  242. form.querySelector(`[value="${selectedTheme}"]`).checked = true
  243. }
  244. }
  245. const prefersColorSchemeDark = '(prefers-color-scheme: dark)'
  246. window.addEventListener('load', () => {
  247. let hasDarkRules = false
  248. for (const styleSheet of Array.from(document.styleSheets)) {
  249. let mediaRules = []
  250. for (const cssRule of styleSheet.cssRules) {
  251. if (cssRule.type !== CSSRule.MEDIA_RULE) {
  252. continue
  253. }
  254. // WARNING: Safari does not have/supports `conditionText`.
  255. if (cssRule.conditionText) {
  256. if (cssRule.conditionText !== prefersColorSchemeDark) {
  257. continue
  258. }
  259. } else {
  260. if (cssRule.cssText.startsWith(prefersColorSchemeDark)) {
  261. continue
  262. }
  263. }
  264. mediaRules = mediaRules.concat(Array.from(cssRule.cssRules))
  265. }
  266. // WARNING: do not try to insert a Rule to a styleSheet you are
  267. // currently iterating on, otherwise the browser will be stuck
  268. // in a infinite loop…
  269. for (const mediaRule of mediaRules) {
  270. styleSheet.insertRule(mediaRule.cssText)
  271. hasDarkRules = true
  272. }
  273. }
  274. if (hasDarkRules) {
  275. loadThemeForm('#theme-selector')
  276. }
  277. })
  278. </script>
  279. </body>
  280. </html>