6 ms·
Given that this uses `target`, doesn't it mean that unlike htmx you can't easily make this gracefully degrade when JS isn't enabled? And, yes, I know, saying "
by Arch-TK 3y ago
Given that this uses `target`, doesn't it mean that unlike htmx you can't easily make this gracefully degrade when JS isn't enabled?
And, yes, I know, saying "when JS isn't enabled" in 2024 is a bit like saying "when the user is on Mars and has a 10 minute RTT" but forgive me for being an idealist.
- beretguy 3y agoI use Disable JavaScript extension with js disabled by default and only enable it if website is broken. https://addons.mozilla.org/en-US/firefox/addon/disable-javascript/ https://addons.mozilla.org/en-US/firefox/addon/disable-javas...
- efilife 3y agoYou should use uMatrix so you can only enable the scripts necessary to unbreak the site
- SushiHippie 3y agoOr uBlock origin (from the same author) which is still maintained
- pmontra 3y agoIt is maintained but the UI for dealing with JS is horribly time consuming and overly complex compared to uMatrix. I'll never really understood it and I keep using uMatrix on my laptop. I switched to NoScript on my phone. Maybe I can install uMatrix now if Mozilla really unblocked many extensions. If uMatrix stops working, I'll switch to NoScript everywhere for JS and uBO for all the other issues.
- samtheprogram 3y agoThis is what I do and it works great - uBlock Origin defaults, and NoScript. It’s surprising how well the internet works without JavaScript.
- SushiHippie 3y agoI've never used uMatrix what can uMatrix do what uBlock can't? I have set all sites to no js, and if something does not work I click the JS toggle in the menu, reload the page and thats it. And yes uMatrix should work on Firefox on Android. ( At least it is installable)
- pmontra 3y agouMatrix has a spreadsheet like matrix of features and sites. It's immediately clear what happens when I click a cell, a column or a row. With uBO I don't even understand where to click to toggle JS for one of the sites a page got scripts from. I learned it years ago but it was too cumbersome. I kept using uMatrix and I forgot it. I attempted to use it again now and I couldn't find anything. I didn't google for it. I installed uMatrix on my phone and disabled NoScript. Of course I keep using uBO for filtering out ads and hiding annoying parts of sites with the element picker.
- deleted 3y ago[deleted]
- samtheprogram 3y agoI use NoScript for this as well, I’ll have to check out uMatrix.
- deleted 3y ago[deleted]
- Kalabasa 3y agoYeah it breaks without JS. You could add the iframe behind JS, so the target would default to a new tab. But the server would still be designed to return HTML fragments. I never found a way for a server to check if the originating request is for an iframe or a new tab. It's not quite a graceful degradation.
- niutech 3y agoThere is a new request header: `Sec-Fetch-Dest: iframe`
- Kalabasa 3y agoWow, thanks! That header's so new. Just months ago. I just added an example using Sec-Fetch-Dest https://github.com/Kalabasa/htmz/commit/6ad3a76be3ee755bb5e777348ce526a704f07050#diff-36239d93e83b88f4c8135ccf21fb7e6c80481f883470d554069ec338e5b2d796 https://github.com/Kalabasa/htmz/commit/6ad3a76be3ee755bb5e7...
- naasking 3y agoYou could intercept the clicks with JS and add a special header, like htmx does, to return fragments, otherwise fall back to full documents. Edit: rather than a header, dynamically adding a query parameter to the URL of the element that was clicked would probably fit better with htmz's approach.
- simpaticoder 3y ago> I never found a way for a server to check if the originating request is for an iframe or a new tab. There is no such technique. One way to distinguish is to pick a URL convention and modify the URL (before the hash) of the iframe URL. For example, add ?iframe=true to the URL, and then have the server check for that. Perhaps more usefully you could include information about the parent URL, e.g. url += '?parent=${document.referrer}'. Or something.
- niutech 3y agoThere is a new request header: `Sec-Fetch-Dest: iframe`
- MatthiasPortzel 3y ago> being an idealist Could you describe your ideals for why websites should gracefully degrade without JS enabled? It’s not an unpopular view on HN, but from my perspective as a web developer, JS is a part of browser application just like HTML, and there’s no reason for the website to work if you’ve disabled a part of the browser. I suspect “doesn’t have JavaScript” is being used as a proxy for a lot of other ideals that I do understand, like “should work on as many devices as possible” but that’s a rough correlation and doesn’t make the use of JS inherently bad.
- account42 3y agoIt's a lot harder to create bitcoin miners or other malicious things without js so I keep scripts disabled by default and only enabe them where it makes sense. Reimplementing browser functionality in JS also often breaks excpectations as things don't work quite the same for all browsers. It also means browser extensiosn are less likely to be able to deal with the content. Essentially it's like wanting your documents in PDF format even though a executables are also part of the PC platform and you could just ship a custom exectuable that renders your document instead. To me JS is just as absurd.
- deleted 3y ago[deleted]
- J_Shelby_J 3y agoChances are I’m on your website for information, mostly text content. Which really doesn’t require JavaScript. So then, most JavaScript on the web is enabling revenue generation rather than improving the user experience. So yeah, disabling JS is a proxy for, “don’t waste my time.” But I agree that it’s not inherently bad, but just mostly bad (for the user.)
- SigmundurM 3y agoA reason people might want to have JavaScript disabled, is because of the immense tracking possibilities that JavaScript has, which can't easily be safe-guarded against. The people who do disable JavaScript completely are admittedly few and far between, but are, I would assume, more common among the Hacker News crowd.
- pmontra 3y agoIt breaks without JS but many JS blocker extensions can be configured to always allow JS from the host serving the page. For example NoScript on my phone has the "Temporarily set top-level sites to TRUSTED" option. With only 181 bytes it could even be included in the page. It's much less than the sum of the meta tags on many sites.
- kevincox 3y agoNot even just without JS. If you middle-click to open a link in a new tab you get just get content that was expected to be swapped in. I think that abusing links is a far bigger sin than adding a custom attribute.
- yawaramin 3y agoThis is why htmx sends requests by default with an HX-Request header so that the server can distinguish between them and serve different content if need be.
- dormento 3y agoI had a dream yesterday, that scientists managed to create a new kind of EMP bomb. This bomb was unusual in that, by varying the level of EM discharge in the payload (dreamy-sciency explanation), it could target all hardware created after a certain point in time. I had access to their facility (dreams being as dreams often are), and managed to set it for 1992, and right when I was about to press the button, I woke up. It RUINED my day.