Live data from Hacker News

An easier way of using polyfills

hacks.mozilla.org

51–60 of 80 posts

Re: An easier way of using polyfills

#51
post #6

While a neat idea in theory, I have some qualms about this. User agent detection sounds great, until you have a user that spoofs their agent. I often do so for various reasons, and from time to time I forget to turn it off after I've finished what I was doing. If this service becomes common, then I will be given broken webpages seemingly at random. The other option, a polyfill covering specific features and served to…

Most JavaScript polyfills first check if the native implementation exists, and only if it doesn't the polyfill is activated. This shouldn't break anything. However, the blog article states they use User-Agent detection over feature detection. I hope they combine these solutions.

They have, apparently. Check it out:

https://cdn.polyfill.io/v1/polyfill.js?features=Array.protot...

Docs about this can be found here: https://cdn.polyfill.io/v1/docs/api

Re: An easier way of using polyfills

#52
post #38
post #25

Does anyone know why is Array.from not able to be supported on the most recent versions of Firefox? (That's the one feature where the polyfill works on older browsers but apparently does not work on newer ones.)

Firefox 32+ supports it natively. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... http://kangax.github.io/compat-table/es6/ There doesn't seem to be anything wrong with Firefox 32+'s implementation.

Thank you; the chart indicates it is not supported natively. There is a feature on the site involving unit tests of each of the features: maybe something about that unit test isn't working on Firefox 32? (Or maybe it is just a mistake, of course.)

Re: An easier way of using polyfills

#54

Something is very wrong with how web developers think about threat models if they're so incredibly willing to load completely arbitrary code into their customer's applications from a source that isn't even remotely party to the vendor/customer relationship.

You would be correct, if that were the case here. But Mozilla as a browser vendor is far from remote to the vendor/customer relationship. That is like writing a Linux application and being concerned because arbitrary code of the kernel is called.

Re: An easier way of using polyfills

#55

Something is very wrong with how web developers think about threat models if they're so incredibly willing to load completely arbitrary code into their customer's applications from a source that isn't even remotely party to the vendor/customer relationship.

As our web applications get ever more complex, and as a side result less secure (on the premise that complex sites are harder to secure than simple ones, and more likely to use features like this which further complicate security), I think we're going to see more and more of a divide between the 'secure' web and modern rich applications.

One of the reasons that I'm such a big fan of Chrome's End-to-End project[0] is that it looks like it may provide a good way to bring real security to modern rich applications. In the current incantation it's not going to be suitable for use in every site out there, but it appears to be a really solid step in the right direction.

[0]: https://code.google.com/p/end-to-end/

Re: An easier way of using polyfills

#56
post #41

Earlier quoted context omitted.

> I'm really glad I'm not a JS developer Yeah, because other languages don't all have their issues... "as a graphic guy" implies strongly "C++". Hardly the pinnacle of language design...

Everyone picks their poison, why can't he be happy with the one he's picked?

My sentiments exactly. He doesn't have to piss on JS.

Re: An easier way of using polyfills

#57
post #43
post #39

Earlier quoted context omitted.

Well, if you never heard that term, and 1) you are a front-end JS developer, perhaps front-end JS development is not for you. 2) you aren't a front-end JS developer, then the post wasn't meant for you, so not much need to explain anything.

3) you were born knowing everything about your trade, so no point posting articles like these.

I was answering to a parent who seems to have deleted his comment.

I'm not suggesting that everybody should know everything about their trade. Polyfill on the other hand is an extremely common thing in the trade. You'd expect a surgeon to know what a scalpel is.

Plus, he put it like: "I don't know what it is and I don't care". How about bothering to Google the names you don't know, instead of demanding everybody else to include introductory terminology lessons in their posts?

Re: An easier way of using polyfills

#58

working on an alternative that doesn't use its own polyfills and instead uses other people's well written libraries. i used polyfill.io before and half the implementations had bugs due to the lack of tests. feedback welcomed! http://polyfills.io

> half the implementations had bugs due to the lack of tests

No, the implementations had bugs because they had bugs.

The bugs were not documented or fixed due to lack of tests or use.

For some this is a distinction without difference; For some, there is a huge difference.

Re: An easier way of using polyfills

#59
post #3

Earlier quoted context omitted.

>User agent detection sounds great, until you have a user that spoofs their agent. Do a significant percentage of users spoof their agent?

Most mobile browsers have a "request desktop site" feature, which I assume would involve spoofing the user agent to look like the desktop version.

Most mobile web applications that would use this polyfill wouldn't have a separate mobile / desktop site and have just a good responsive design, so mobile users wouldn't feel a need to request the desktop site. That feature is usually used (I assume) because the mobile versions of websites often offer limited functionality.

Re: An easier way of using polyfills

#60
post #5

Earlier quoted context omitted.

Users that spoof their user agent are likely to either be tech-savvy people who either know what they are doing or who are hiding who they are, like a bot. I'm more worried about supporting older users on old machines who barely know the difference between Internet Explorer and the internet than in supporting someone who knows exactly what a UA is and how to spoof it.

Take a look at what Microsoft is doing with their newest mobile IE browser - http://blogs.msdn.com/b/ie/archive/2014/07/31/the-mobile-web... Basically they're crafting the UA to appear like Chrome or Firefox.

But only because web developers buckled and added loads of workarounds for older versions of IE.
Post reply on HN