Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've thought to myself, "I wish there was a timeout attribute on the <script> tag," about once every few months for the past 10 years. Is there any good reason you can't manually specify how long you want the browser to wait for an external file to load?


There's no reason you couldn't code this up in JavaScript:

  load jquery from google
    - onload, set flag jquery_loaded
  settimeout load_locally_if_not_flag 5sec


Don't forget that JavaScript is blocking. You'd need to load the jQuery from Google dynamically by inserting script tags.

By the time you've added that, timeouts and fallbacks the amount of inline JS would make hosting jQuery on a CDN pointless.


You can at least control the degree of blocking in the latest Webkit: http://webkit.org/blog/1395/running-scripts-in-webkit/


I believe FFox 3.6 supports async attribute as well




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: