4 ms·
What happens if I have JavaScript disabled (and I do have)?
by gkya 11y ago
What happens if I have JavaScript disabled (and I do have)?
- onion2k 11y agoYou don't see anything.
- gkya 11y agoWhich is bad if them notes are not ornaments only. So there should be some fallback. I guess a good approach would be to collect the content from some p.marginnote elements which would be hidden if JS is present and left intact if not. So, like <a href='#' mnref='gcc'>GCC</a> ... <p class='marginnote' mnname='gcc'>The GNU Compiler Collection</p> With JS, they'd become margin notes, whithout it, they'd render as plain footnotes.
- onion2k 11y agoSure, but as the README.md states "adds notes to the margin with the text provided in HTML attributes" it's presumably left up to the user how else they display the data if they want it to be visible for people who disable JS. This library is a progressive enhancement. It's very much the right way to do web dev in my opinion.
- NoGravitas 11y agoIt's almost the right way -- somewhat better would be to do what one of the above comments say, to add the notes as footnotes using POSH. Then the javascript can rewrite the footnotes into hide/show marginal notes with the same appearance and user interface as this library.
- geocar 11y agoWhy not just: <a href="#fn-gcc" class="has-footnote">GCC[1]</a> … <p id="fn-gcc" class="marginnote"><label>1. </label>The GNU Compiler Collection</p> It's compatible with the W3C recommended idiom for footnotes[2], is accessible without JavaScript, and you can still use `.marginnote` to provide CSS styling. [2]: https://www.w3.org/TR/html5/common-idioms.html#footnotes https://www.w3.org/TR/html5/common-idioms.html#footnotes
- gkya 11y agoWell if this works it seems better, I'm mostly a user of hypertext so a bit ignorant, sorry.
- dspillett 11y ago> and I do have So you can tell us: what happens if you have Javascript turned off? I have sympathy for the "what happens if I'm using a screen reader or other accessibility device" question, not excluding those who need to use assertive technologies where possible is important. geocar's post below suggests what might be a better implementation in that regard, which will support your use case too, but some advanced screen readers might try run the script (to access generated content like Google does for indexing) and then not read the text because said code has hidden it via DOM manipulation, meaning the technique might not work in all cases. But disabling all javascript and expecting the world to support your preference in everything we produce (you can at least read be core content in this case) feels a bit entitled IMO, along the lines of people/companies (who I deal with in my day job) who use legacy browsers and are upset when that means they can't have shiny new features in the browser based applications that they use (or want to use). I understand the desire to block all the iffy JS (adverts, particularly adverts that eat CPU cycles and therefore my battery when mobile, tracking, and so on) and I understand that running noscript or similar plugins is too cumbersome in many opinions, but unless you are paying for the content in some way you can't really expect to demand to control how it is delivered to you. A thought for reducing tracking and such without blocking code used for page functionality: I'd like to see browsers block 3rd party code as an option (as some do for 3rd party cookies), with a whitelist to enable CDNs (possibly with the major CDNs on the whitelist by default). That would still allow iffy code if it is served from the same site (by design or because it has been hacked) so isn't perfect, but it might be a good compromise.
- gkya 11y agoI disable javascript for two reasons: I do not want to download megabytes of useless scripts everyday dozens of times, and I do not want to allow strangers run arbitrary Turing-complete code on my computer, even on a restricted platform like the browser. Thus, I use xombrero + very strict whitelisting. I do not want the world to conform to me, I just conform selectively. I know the consequences of being a NoJS surfer, I just live with it, and don't complain. I even have chromium installed for edge cases. And here I try to make some criticism of the posted work, and constructively. I think coding defensively for the noscript case is a good, important practise, even if the chosen remedy is to show up a "please enable JS" message. And then there's the case of printing the page, the read-it-later things, archival, etc... I can't run JS on paper, or on PDFs, right? But the WWW is ephemeral, and if something is important, I have to archive. And people have disablities, how would margin notes be readable with say 5x zoom? How will a disabled person get to read the popup margin note if he can't even move the mouse to hover the anchor tag? One may well say that disabled people are not worthy of seeing their content, and however disgusting may it sound they've the right to say so, but the OP may be open to such suggestions for inclusivity and improvement, and I suggest. I think the JS CDNs are the most stupid things on the world. It is a virus vector. Hack one CDN, and you'll get to run your code on maybe millions of websites. And who decides which CDNs are major, and/or better or more secure?