3 ms·
The standard pattern is never use external dependencies directly, but to keep copies and host them on your CDN. For dependencies you can control, it's obviousl
by grey-area 13y ago
The standard pattern is never use external dependencies directly, but to keep copies and host them on your CDN.
For dependencies you can control, it's obviously best to keep a local or CDN copy. However this trend of embedding js from all over the web is encouraged by the pattern that most of the big sites allowing you to embed content use:
e.g.
https://developers.google.com/+/web/badge/ https://developers.google.com/+/web/badge/
Google, Twitter, FaceBook all want you to embed js hosted on their servers in your page in order to interact with their site, even if all that script does is then insert an iframe into the page. By including a button or widget like the one above you're trusting them not to take over your site in a manner similar to this example, track your users surreptitiously, or be compromised now or in the future.
- jacquesm 13y agoOne thing that will happen is that domains that get abandoned that used to host benign js will get taken over by the jerks. That's very hard to protect against, and with the rate at which start-ups encourage people to embed their tags I'm kind of surprised there hasn't been a significant incident like that.
- mtrimpe 13y agoGood point. I imagine you could make a pretty penny by hijacking credit card detail entry forms. To evade detection you can even have the hijacking code only included on pages that actually collect credit card info.
- sneak 13y agoOr only serve it to 10% of requests, making it a heisenbug for the site owner attempting to track it down. :D